Home > database >  Importrange with query and reorder some of the columns on import Google Sheets
Importrange with query and reorder some of the columns on import Google Sheets

Time:01-14

I have a sheet with 52 columns from A to AZ. I am importing these with Importrange and query to a different file.

I want to move Column X to the first column on the import

Is this possible to do without listing the order of all 52 columns in the query?

=ARRAYFORMULA(
  QUERY(
    {
      TRIM(IFERROR(IMPORTRANGE("1Qe####","Sheet1!A2:AZ"&counta(importrange("1Qe###","Sheet1!A2:AZ")))))
    },
    "select col24, col1,...,col52",1
  )
)

CodePudding user response:

Here's one approach and change it accordingly:

=QUERY(IMPORTRANGE("SPREADSHEET ID","Sheet1!A2:AZ"),"Select Col29"&", "&SUBSTITUTE(JOIN(", ",INDEX("Col"&SEQUENCE(52))),", Col29",""))

  • Related