Search code examples
google-apps-scriptgoogle-sheetsgoogle-apps

How to prevent Apps Script from opening multiple projects?


I have an html dialog for Sheets (container bound dialog) that is used for input and saving of customer data. I made a copy of it for use in a different office, so now I have Worksheet#1 with Script project "Scripts" and Copy of Worksheet#1 with Script project "Copy of Scripts". We've made changes to Scripts so it is no longer the same as Copy of Scripts.

Sometimes Worksheet#1 triggers scripts that are in Copy of Scripts. Not sure why. On these occasions I can open up script editor and it asks which project to open (Scripts or Copy or Scripts) and once I select the right one it behaves properly until the next time this happens.

How can I insure that it always opens the correct project?


Solution

  • You will see this behavior sometimes if you have multiple projects within a script.

    1. Check whether you have multiple projects in one of those sheets.

      File > Open...
      

      Here's a spreadsheet-contained script with two projects in it:

      screenshot

    2. Open the project you want to delete.

    3. Delete it.

      File > Delete Project...
      

      Delete dialog