Home > OS >  Is this a bug using query function in google sheets? It kind of doing a grouping, or am I missing so
Is this a bug using query function in google sheets? It kind of doing a grouping, or am I missing so

Time:04-04

Just trying to make a small example, so I used a {} range, but also happens in a sheet when I use a A1:E5 type range

=query({"a","x1","","y1","";"a","x2","","y2","";"a","x3","","y3","";"b","x4",1,"y4",2},"select *")

results in (will use | to show column breaks)

| a a a | x1 x2 x3 || y1 y2 y3 ||
| b | x4 | 1 | y4 | 2 |

CodePudding user response:

Your post formatting did not hold up. But what you are seeing is Google Sheets attempting to "guess" at how rows you want as part of the header. To solve this, just end your QUERY this way:

"select *",0)

That will specifically tell QUERY that you want zero rows as part of the header.

CodePudding user response:

it's hard to tell what is your true intention with a QUERY... the result you are getting:

enter image description here

is equivalent to:

enter image description here

and as mentioned, query likes to guess the formatting if it is not specified

addendum:

usage of select * is pointless. if you want to output all columns just skip it:

enter image description here

if you face unexpected formatting don't forget to include the 3rd QUERY parameter. tho if the 3rd parameter is 0 you are good to skip it as well

and ofc if you not "querying" skip the QUERY too:

enter image description here

enter image description here

  • Related