0

I'm going to admit I'm a newbie at scripting. I've managed to write the script that I want but I want it to automatically run after importing the CSV file onto Google Sheets.

I have tried a simple trigger of onEdit(e) when combining it with "Replace current sheet" when importing but this doesn't work. It is only triggered when I edit the cell even though the full sheet has been edited. I've tried appending and replace data at selected cell but it's not doing what I want.

Is there another way to achieve this?

For context the current script I have built deletes columns with a specific header.

I was thinking about using a script that would automatically run after detecting a specific string but I haven't found anything online to suggest I can do this.

Any help would be greatly appreciated :)

1 Answer 1

0

The simple trigger onEdit only works when a user manually edit one or more cells, more specifically when the user:

  • Type directly on a cell
  • Type directly on the formula bar
  • Paste over one or more cells (the paste action should modify the cells, pasting an image over the grid will not make the onEdit function to be executed)
  • Paste over the formula bar

Try using the installable trigger change for spreadsheets. For details on how triggers works, the differences between simple and installable triggers, how to create installable triggers and the Google Apps Script event objects please read https://developers.google.com/apps-script/guides/triggers, https://developers.google.com/apps-script/guides/triggers/installable and https://developers.google.com/apps-script/guides/triggers/events

NOTE: A change installable trigger listen to changes to the associated spreadsheet, so you might need to make use of JavaScript control statements like if or switch.

Related

1
  • Thanks! I ending up using a trigger which would run the function after a change event on the spreadsheet.
    – Aryan
    Sep 26, 2021 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.