Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

198
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda