1

I have program that generates a spreadsheet documenting experiment results. I have written an app script to calculate the results and do formatting on the sheet.
It is working for the first file but when another spreadsheet is used I want to run the same script on that also.
As I am unable to find any link to the script that I have written, I want to know how I can use the same script for different spreadsheet files.

Rubén
  • 34,714
  • 9
  • 70
  • 166
t0mkaka
  • 1,843
  • 2
  • 17
  • 21
  • 1
    Does this answer your question? [How to protect the Apps Script code in a Google spreadsheet?](https://stackoverflow.com/questions/16075446/how-to-protect-the-apps-script-code-in-a-google-spreadsheet) – Rubén Aug 30 '20 at 23:33

1 Answers1

1

You can convert your script in the first spreadsheet as a library and access it from the second. More information : https://developers.google.com/apps-script/guide_libraries

Srik
  • 7,907
  • 2
  • 20
  • 29
  • Thanks for the response. But with the help of libraries I was able to copy and paste less and directly use the function from the library identifier. But still I have to create a seperate project for that spreadsheet and copy and paste the library id and then run. I was looking for like just run the function directly from the spreadsheet menu. Just like we do formatting. Is there something like that available without publishing the script. Thanks again. – t0mkaka Sep 14 '12 at 12:02
  • 2
    Unfortunately no. You have to create a new project in each spreadsheet. However, you can have a blank spreadsheet with the code and make a copy of this spreadsheet so that the code is available in the new spreadsheet – Srik Sep 14 '12 at 16:29
  • Thanks. This Idea is better to create a blank spreadsheet and just copy it. Thanks a lot. – t0mkaka Sep 15 '12 at 17:08