I'm having an issue. Whenever I create a new spreadsheet, I'm not able to add a script I've already created. The list for recent projects or scripts is always blank. Anyone have a resolution or do I always have to copy the script code and insert it into the spreadsheet?
Google Sheets – How to Reuse Google Apps Scripts in a New Spreadsheet
google sheetsgoogle-apps-script
Related Topic
- Google-sheets – How to export / import a Google Apps Script as a file into a new spreadsheet
- Google Sheets – Show URL to Edit Google Form Responses
- Google Apps Script – Run Locally to Process Spreadsheet Data
- Google Docs – Add Scripts or Add-Ons to New Document
- Google-sheets – How to manipulate text strings in Google Apps Scripts
- Google Sheets – Read .tsv Files from Local Drive Using Apps Script
- Google-sheets – How To Create a Globally Accessible Apps Script for Docs and Sheets
Best Answer
You can add your script as a library in the new spreadsheet. Lets start from the beginning. This sample code will add a string to the active cell:
Save the script, by creating a version:
Next, copy the Project Key from the script editor:
Publish the script as a web app (execute only you):
In the new spreadsheet, open the script editor. Chose Manage Libraries from the resources option and enter and select the key/library:
In the script editor you can now add the following code: