简体   繁体   中英

importrange query with date range last few months only

i am using a importrange function with specific columns, what i want is to pull data only for last few months from today. you can see in link below, formula is in A2. link

=QUERY(IMPORTRANGE("google sheet url", "Collection:A4,AG"),"select Col4, Col9",0)

You can see what i want has been described in column C, Column A ranges dates from 2019 to 2022 but i want to import only data from last few months from today.

Add where condition to query function to remove null cells and filter last four months data. Try-

=QUERY(IMPORTRANGE("13o5oRHXJOns3Onnr9L72m9BJVXXG58ukGJh7aUO8fTM", "Collection!A4:AG"),
"select Col4, Col9 where Col9 is not null and Col4 >=date '" & TEXT(TODAY()-120,"yyyy-mm-dd") & "'",0)

See you gs sheet name harun24hr .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM