Anti-nuisance lawsuit warning: The purpose of these notes is to remind me, Zoegond, of stuff or to help me work stuff out. They may contain mistakes.

Quick

  • ($a, $b....) = unpack("A2A7...", $packed)
  • push( array, list )

Sunday, December 6, 2020

Google Sheets QUERY column headings

The big problem with QUERY is that it generates unwanted column headings in its results. But I noticed that it doesn't always do that, and reading this article explained why

https://davidmeindl.com/google-sheets-how-to-remove-headers-from-query-result/

To summarise what he says, there are 2 circumstances in which QUERY adds headers, and corresponding ways of getting rid of them:

  1. Including headers in the range specified as parameter 1 to QUERY
    • Specify 0 as parameter 3 to QUERY, so the headers aren't in the input
    • Specify OFFSET 1 in the query, so that the header row is not output
  2. Having an aggregation function in the query, eg SUM
    • Specify eg LABEL SUM(B) '' in the query (can never make that work myself)
    • Use an outer query with OFFSET 1 to skip the header row - QUERY(QUERY(range, "SELECT SUM(B)"), "SELECT * OFFSET 1")
    • NEW If your actual result set only has 1 row of data, use CHOOSEROWS to choose it as row 2 (row 1 being the headers) - CHOOSEROWS(QUERY(range, "SELECT SUM(B)"), 2)

Followers

Blog Archive