Workaround: Automatically Installing OnEdit Trigger to Copied Google Spreadsheet using Google Apps Script
This is a workaround for automatically installing the OnEdit trigger to the copied Google Spreadsheet using Google Apps Script.
The sample situation for this workaround is as follows.
- You have a Google Spreadsheet.
- Your Spreadsheet is shared with a user as the writer.
- Your Spreadsheet has a button for executing a script for copying the active Spreadsheet.
- Your Spreadsheet has a function
installedOnEditfor executing by the installable OnEdit trigger. - You want to make the user copy the active Spreadsheet by clicking the button, and also, you want to automatically install the OnEdit trigger to
installedOnEditfor the copied Spreadsheet, simultaneously.
This method is from “Using OnEdit Trigger to Google Spreadsheet by Hiding Google Apps Script from Other Users (Author: me)” and “Using OnEdit trigger on Google Spreadsheet Created by Service Account (Author: me)”.