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

258
Vistas
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 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