I am using this formula to bring data from another spreadsheet file based on name of the month. This time for February..

=query(importrange("1L86iP0GLHTubwfvxs1kJ4ocbmgRAd4Iz0000000M","'February'!A2:F"),"Select Col6, Col5 where Col1 is not null",0)

But I would like to type the cell that has the month name instead of writing the month manually in each formula. If the cell C1="February" in file A and C1="January" in file B, how can I write C1 instead of month name in the formula? for example like this:

=query(importrange("1L86iP0GLHTubwfvxs1kJ4ocbmgRAd4Iz000000jbcM","'C1'!A2:F"),"Select Col6, Col5 where Col1 is not null",0)

1 Answer 1


Judging from your formula, February or January must be tab names belonging to the spreadsheet.

If that is the case, use the following syntax

=query(importrange("1L86iP0GLHTubwfvxs1kJ4ocbmgRAd4Iz0000000M", C1&"!A2:F"),"Select Col6, Col5 where Col1 is not null",0)

where cell C1 has a value of February or January or...

(If still in trouble please explain better or share a test sheet.)

  • 1
    Yes February and January are Tabs.. It worked thanks alot Feb 19, 2021 at 7:13
  • Thank you for taking the time to accept. Feb 19, 2021 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.