Home > other >  Using query importrange to populate data from columns in specific column - to leave a column blank
Using query importrange to populate data from columns in specific column - to leave a column blank

Time:10-05

I want to import data from one sheet to another using Query Importrange, however I want to select a column that should not be imported directly after the previous column import, for example; I select Col1, Col2,Col3,Col6 from sheet 1 but Col6 should appear in a specified column not the following column to where Col3 was placed.

Currently I am using this formula:

=IFERROR(QUERY({IMPORTRANGE("/13Ptmj3sejlOADvwhgfBPxRy_H-RGCxLX4r2jecbceIE/", "Sheet2!A2:F")}, "Select Col1,Col2,Col3 where Col1 >= date '2022-09-01' and Col1 <= date '2022-09-30'" ,0))

Sheet1!A2 should be where it all starts so Col6 from sheet2! would need to be placed in Col7 in sheet2!

This may not even be possible but it would be preferable to do it this way rather than entering another formula

CodePudding user response:

here is how you offset Col6 by one column:

=IFERROR(QUERY(
 {IMPORTRANGE("13Ptmj3sejlOADvwhgfBPxRy_H-RGCxLX4r2jecbceIE", "Sheet2!A2:F")}, 
 "select Col1,Col2,Col3,' ',Col6 
  where Col1 >= date '2022-09-01' 
    and Col1 <= date '2022-09-30'
  label' '''", 0))

or by 3 columns:

=IFERROR(QUERY(
 {IMPORTRANGE("13Ptmj3sejlOADvwhgfBPxRy_H-RGCxLX4r2jecbceIE", "Sheet2!A2:F")}, 
 "select Col1,Col2,Col3,' ','  ','   ',Col6 
  where Col1 >= date '2022-09-01' 
    and Col1 <= date '2022-09-30'
  label' ''','  ''','   '''", 0))
  • Related