Getting filtered data by time range in Google Apps Script

Hi, guys!
I’m trying to get the items created in the last 30 days of a specific board by calling Monday API in Google Sheets using Google Apps Script. The code to call the API and parse JSON is not a problem. I’ve done that before and it was successful. The problem is filtering the data by a date range.

What I’ve already tried:

  • I’ve used items_by_column_values and that would work perfectly if the argument column_value accepted a time period in GraphQL. But sadly it only accepts one value.

  • I’ve tried this query:
    query {
    boards (ids: 157244624) {
    items(limit: 1000, newest_first: true) {
    name
    }
    }
    }

That’d work because I’d get the newest items of a specific board. But I saw in a post that the argument newest_first in items doesn’t work when nested in boards :confused:

I saw in another post that I could add a date range in my end (Google Apps Script) , but I don’t know how to do that.

Can anybody help me with sample code in Javascript / Google Apps Script or a link where I can study that would help me get data filtered by a Date Range using Monday API?

Thanks in advance!!

Hey @rodrigosuguimoto - welcome!

The newest_first argument not working when nested is something we’re looking to fix on our end, but I wouldn’t have an ETA for you just yet at this time.

At this time the only way to accomplish this would be to pull all the data and then filter within your app.

-Daniel

1 Like

Hey @dsilva! Thank you for your response!

1 Like