How to select record using range of date from google sheets

I am trying to filter the records from google sheets.

  1. Condition I need to apply a date range on column named Date.

could not find any example how to pass the range in filter for get many rows.

  1. How to use multiple values for filter Ex. for column Name i want to filter for records with value [Name1, Name2]

  2. How to get the records for a given month.

I cannot pull the entire sheet and use filter as the sheet i very large ~ 5k records and is expected to grow

Hi @Manu_Pratap, welcome to the community :tada:

n8n’s Google Sheets node does not allow this kind of filtering I am afraid. So you would need to think about alternatives here I am afraid.

If your current n8n instance does not come with sufficient memory to process 5,000 records in a single execution you could consider switching to a more capable database supporting the kind of filtering you need. PostgreSQL would for example let you write filters checking if a field value is within a range or if a string value is part of an array you provide.

If switching away from Google Sheets is not an option in your case you could alternatively consider adding new columns with a formula performing the check you have in mind. Then return a single value depending on the outcome which can be used in the respective n8n node.

Consider for example a formula like =TEXT(A2,"MMMM"). This would allow you to easily fetch all records in n8n for September like so:

image

This would also work for your array by using a formula like =IF(OR(B3="bar", B3="baz"), "Yes", "No"):

Hope this helps :slight_smile:

1 Like

Thanks @MutedJam
this approach of using formula works.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.