Search code examples
google-sheetsgoogle-sheets-querygoogle-sheets-formula

Why is my Google Sheets query repeating row headers down the page, and not the data contained in the header?


I'm trying to avoid selecting "A,B,C,D" etc because I need to reuse this formula in several different pages at different column locations. I'm also not using the "*" because I need to avoid a col in the data. The problem right now is that when I select "A" which is "Coin".. it should return all the data (coins - BTC,LTC etc) listed under that header. Instead, the query is repeating just the header name and substituting that over and over again instead of the actual data. Is there a fix to this? Or does anyone know why this is happening? Using -1 for headers doesn't change anything. It's like it is selecting a container around the data, but not the actual data. I've never seen it do this and I've been using queries for some time now. Won't let me post inline screenshots so links included in the bottom.

Example sheet: https://docs.google.com/spreadsheets/d/1daTlT06qtV8WigOIFGEZk7WoYkR7ephcIf7iWigmgrY/edit?usp=sharing

=QUERY(Saved!A3:K,"select 'Coin'")

This is what it should return | And this is what it returns currently:

Coin                     "Coin"()
BTC-FCT                  Coin
BTC-EXCL                 Coin
BTC-PART                 Coin
BTC-FLO                  Coin
ETH-ADX                  Coin
BTC-SWT                  Coin
BTC-SPHR                 Coin
BTC-DYN                  Coin
BTC-TX                   Coin
BTC-SIB                  Coin
BTC-OST                  Coin

Source Data Query


Solution

  • In Google Sheets, the column names to be used on select clause of QUERY function when a range reference is used as the first argumente are the Google Sheets column letters. In other words

    instead of

    "select 'Coin'" 
    

    use

    "select A"
    

    Reference