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

265
Visualizações
Google App Script: How to Store rowcount and modify to update stored rowcount

This is what I am trying to achieve with the function propertiesstorage():

  1. Store and save row count in property storage in google appscript.
  2. Make the stored row counts update with the new rowcounts added. For example 1st stored rowcount === 2000 + 2nd stored rowcount === 2000 = rowcounts 4000 in total.So forth and so on

Code


function rowcount()
{ 
 
  var token = getAccessToken();
  var module = "sHistory";
  var rows = 0;
  var go = true;
  var i = 1;
  var data;
  var page = 0;
  
   while (go) {
    Utilities.sleep(20000);
    data = getRecordsByPage(i,200,token,module);
    if (Number(data.info.count) < 200) 
    {
      go = false;
    };
    if ((i%10) == 0) 
    {
       go = false; 
    }
    else if (Number(data.info.page) === true)
    {
      go = true;
      
    }
    page = Number(page) + Number(data.info.page);
    rows = Number(rows) + Number(data.info.count);
    
    //Logger.log("Page " + page);
    //Logger.log("Zoho Recruit Records" + rows);
    i++;
     
   }
      return rows;   
   }

function propertiesstorage()
{

  // saving rowcount in GAS properties
  var scriptProperties = PropertiesService.getScriptProperties();
  scriptProperties.setProperty("sHistoryRows",rowcount());
  
  //reading rowcount from GAS properties
  var scriptProperties = PropertiesService.getScriptProperties();
  var data = scriptProperties.getProperties();

  for(var key in data)
  {
    Logger.log([key,"sHistory total count "+ rowcount()]);
    
  }

  var scriptProperties = PropertiesService.getUserProperties();
  var updatevalue = userProperties.getProperty(rowcount());
  updatevalue = rowcount();
  scriptProperties.setProperty("sHistory total count",updatevalue)
  Logger.log([key,"sHistory total count "+ updatevalue])

}
}

This is the reference I am using to try and achieve this - https://developers.google.com/apps-script/guides/properties

about 4 years ago · Juan Pablo Isaza
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