Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

226
Visualizações
Script for last edited/modified time & date

I have been searching around for a script that will give me the time & date that a google sheet was last modified.

I have a list of all the google sheet workbook IDs in column E of a sheet called 'Planner Directory' and I would like it to return the time & date last modified in column F.

This would be really helpful if anyone can assist?

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Since you already have all the data in a Google Sheet, I think the easiest way to get this working automatically is using Google Apps Script. I will leave an example of how it would work.

Try this code:

function myFunction() {
  var ss = SpreadsheetApp.getActive().getSheetByName("Sheet20"); // Change it to the name
                                                                 // of the sheet you. are using
  var range = ss.getDataRange();
  var values = range.getValues();
  for(var i=1; i<values.length; i++)
  {
    values[i][1] = lastModifiedTime(values[i][0]); // 0 is the column number in my testing sheet
                                                   // where the IDs are.
                                                   // 1 is the column number where the time will be.
  }
  range.setValues(values);
}

function lastModifiedTime(id)
{
  var file = DriveApp.getFileById(id);
  return file.getLastUpdated();
}

Input data:

Replace the Sheet ID fields with valid IDs.

enter image description here

Result:

enter image description here

Remember to change the format of the column where you want you have the last modified time to Number > Date time.

Now, in order for you to automate this script you can use a time-driven trigger from Google Apps Script so that the script runs every 5, or 10 minutes for example and so that you can always get the latest time in the results.

Trigger:

enter image description here

References:

  • Method: getLastUpdated()
  • Time-driven triggers
about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda