Home > Mobile >  Google sheets Query and Importrange - selecting different columns from different sheets
Google sheets Query and Importrange - selecting different columns from different sheets

Time:10-06

I want to import data from Sheet_Alpha and Sheet_Beta.

In Sheet_Alpha, the columns I want are columns A, C, and D.

In Sheet_Beta, the columns I want are E, H, and N.

On the combined sheet, these columns will match up perfectly, but the source sheets are different.

Neither Sheet_Alpha nor Sheet_Beta can be altered.

What would be the syntax here?

Alternately, what other method could I use to accomplish this?

Thanks.

CodePudding user response:

run IMPORTRANGE on Sheet_Alpha and then on Sheet_Beta to allow access. then use:

=QUERY({IMPORTRANGE("url", "Sheet_Alpha!A:D"), 
        IMPORTRANGE("url", "Sheet_Beta!E:N")}, 
 "select Col1,Col3,Col4,Col5,Col8,Col14
  where Col1 is not null")

or if you want it all under:

=QUERY({QUERY(IMPORTRANGE("url", "Sheet_Alpha!A:D"), "select Col1,Col3,Col4"); 
        QUERY(IMPORTRANGE("url", "Sheet_Beta!E:N"),  "select Col1,Col4,Col10")}, 
 "where Col1 is not null")
  • Related