I’m trying to figure out how to modify my Google Sheets query to include empty columns in the results. I’m working from a different sheet and pulling specific data, but I would like to have the output appear in a non-adjacent manner.
=query(Sheet!A7:A, "Select A,B,C where A='Order'")
My goal is to get the output in columns A, E, and F, instead of them being side by side.
Currently, I’m using this method:
=query(Sheet!A7:A, "Select A,X,Y,Z,B,C where A='Order'")
Here, I’m adding empty columns (X,Y,Z) at the end of my range as a workaround. It functions but seems a bit unrefined.
I’m looking for a more efficient solution to achieve this spacing in the Google Sheets query results, but haven’t found anything useful in the documentation.
honestly your workaround is probly the best bet here. ive tried using arrayformula tricks but they get messy real quick and break easily when you update data. the dummy column method might look hacky but its actually pretty solid - just make sure you have enough blank columns for future changes
The approach you’re using is actually quite common and not as unrefined as you might think. Many experienced users rely on similar workarounds because QUERY has inherent limitations with output formatting. I’ve dealt with this exact issue multiple times and found that your method of adding empty columns to the source range is often the most reliable solution. The key is making your dummy columns predictable - I usually add several blank columns at the end of my data range specifically for this purpose. While it might seem clunky, it’s actually more stable than trying to manipulate the output afterward with complex array formulas or splitting the query across multiple cells. The QUERY function prioritizes data retrieval over presentation formatting, so working within those constraints rather than fighting them tends to produce better long-term results.
Unfortunately, the QUERY function in Google Sheets doesn’t have a built-in method to insert empty columns directly within the query syntax itself. Your current workaround is actually one of the most practical approaches available. However, there’s an alternative method you might consider using ARRAYFORMULA combined with column references. You could structure your formula like ={query(Sheet!A7:C, "Select A,B,C where A='Order'"); ""; ""; query(Sheet!A7:C, "Select B,C where A='Order'")} but this gets complex quickly. Another approach is to use the QUERY result as a source and then reference specific cells from that result in your desired columns using simple cell references. This keeps your logic cleaner than expanding your range with dummy columns, though it requires more setup initially.