Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

195
Views
How do I search Google Drive API by date?

I am using Google Drive V3 API to manipulate files in a folder.

What I am currently doing to list all my files is like so:

const data = await drive.files.list({ q: `'${folderId}' in parents` });
console.log(data.files);

So basically I'm using a service account to query a folder for all its files. I'd also like to query for date. Something like createdTime < ${date}.

Reading through a few posts on this site and the documentation, there doesn't seem to be such a feature to do so. I can see that there is the option to use modifiedTime, however when I try to use it, everything just freezes up and the script run indefinitely.

Does anyone have any ideas as to how I can query this?

Edit 21/10/12 11:08

So I tried doing the following per Taneike's suggestion:

console.log('1') //this logs in the console
const data = drive.files.list({
    q: `'${folderId}' in parents and createdTime > 2012-06-04T12:00:00-08:00`,
});
//unreachable code below
console.log('2') //this doesn't log
console.log(data) //this doesn't log

So basically my script will run indefinitely, and I have to manually end the script. drive.files.list won't return anything.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I thought that createdTime < date can be used. And, when I saw your script, I noticed that there is a modification point. And, from your replying of So at the moment, I am able to retrieve all the files in 'Folder A' by using {q: ''${folderID}' in parents'}. What I would like to do is also query it by date. So for example, {q: ''${folderId}' in parents and createdTime < ${date}'}. –, I thought that there might be also a modification point.

When the above points are reflected in your script, it becomes as follows.

Modified script:

const data = await drive.files.list({q: `'${folderId}' in parents and createdTime < '${date}'`}).catch((err) => console.log(err.errors));
console.log(data.data);
  • In this case, please set the value of date like 2012-06-04T12:00:00-08:00 as RFC3339 format.

References:

  • Files: list
  • Search query terms and operators
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!