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

157
Visualizações
Is there a way to define a changeType for an onChange event trigger in Google Apps Script?

I have an inventory spreadsheet with a function that copies and renames an Order Template to create a new Order sheet when you click a button. The function then renames the sheet to the name for the order. Additionally, I have another function, updateSheetList(), that copies all the Order sheet names and populates a column which is used with data validation to create drop down menu within a cell on the sheet.

Currently, I have a button on the sheet to update this list for the drop down menu. I would like to automate this so that when a new order sheet is either added through the copy/rename function or deleted manually, it runs the updateSheetList() function automatically.

The current code that I have to do this is below:

function onChange(e){
  if (e.changeType == 'INSERT_GRID' || e.changeType == 'REMOVE_GRID'){
    updateSheetList();
  } 

The trigger works when a sheet is deleted but does not work when I use the copy/rename function. I have realized that the INSERT_GRID changeType only works when a sheet is manually created and not when it is duplicated.

So is there a way to either create a custom changeType so that the onChange() function triggers when a sheet is duplicated? Is there an alternative workaround to get this to work without using the onChange() trigger?

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