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

267
Vistas
How do I get my code on google sheets to cover multiple tabs?

I have a code that runs on my google sheets every time someone fills out a form online which pushes info into my CRM Software. It pulls the info in great off of the main tab; but how can I get the script to run for multiple tabs on the same spreadsheet? I tried a couple solutions but couldn't figure it out. this is the current code

var sheet = SpreadsheetApp.getActiveSheet();

var scriptProperties = PropertiesService.getScriptProperties();   
var lastRange = scriptProperties.getProperty("last_range");

//Logger.log("Debug:" + lastRange);

if (!lastRange) {
  var lastRow = sheet.getDataRange().getLastRow() + 1;
  scriptProperties.setProperty("last_range", "A" + lastRow);
  lastRange = scriptProperties.getProperty("last_range");
}

var range = sheet.getRange(lastRange);
var totalRange = sheet.getDataRange();
var isBlank = range.isBlank();
var isGreater = false;
 
about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

You are currently using:

var sheet = SpreadsheetApp.getActiveSheet();

Where you should be using:

var sheet = SpreadsheetApp.getActive().getSheetByName(sheetName);

You haven't specified which tabs (sheets) you have, but it should be a simple case of dropping in the appropriate sheet name in the function above.

See https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet#getSheetByName(String)

about 4 years ago · Santiago Gelvez 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