Select columns by name rather than letter in Google Query Language (GQL) with Google Spreadsheets?

前端 未结 3 1590
时光取名叫无心
时光取名叫无心 2021-01-02 15:37

newbie question, is it possible to select columns by name rather than letter when using Google Query Language with Google Spreadsheets?

This works fine for me: \"S

3条回答
  •  鱼传尺愫
    2021-01-02 16:25

    This is currently not possible. The GQL documentation states[1] "Columns are referenced by the identifiers (not by labels). For example, in a Google Spreadsheet, column identifiers are the one or two character column letter (A, B, C, ...)."

    If you want to do this in a spreadsheet it is possible with the following formula to convert a column header name into a letter (some tweaking might be required +1 (might be +2)). It also relies on column headers being unique and not containing commas

    =REGEXEXTRACT(ADDRESS(1,COUNTA(SPLIT(LEFT(JOIN(",",TRANSPOSE(1:1)),FIND("your_column_name",JOIN(",",TRANSPOSE(1:1)))),","))+1,4);"[a-zA-Z]+")
    

    [1] https://developers.google.com/chart/interactive/docs/querylanguage#Select

提交回复
热议问题