Google app verification lost from google apps script project when copying sheet

I have developed a google apps scripting app that uses a spreadsheet as their database,

I provide the app to clients by giving them the url to make a copy from the spreadsheet (the script is in that spreadsheet) and they allow and use the copy.

Lately, my clients are getting an "Unverified Applications" screen before allowing the script. so I filled out a google validation form and google validated it , but my clients are still getting an unverified screen ...

I suspect the problem is that every sheet gets a new project id and client id when copied , so google validation does not apply to them.

Does anyone know what solution I can check on a copy? or is there any other way to expose the application to people without requiring them to make a copy, and yet each should have their own script and spreadsheet?

+3


source to share


1 answer


While there is no solution to keep the same project ID when making a copy, you can publish your project as a web app and create a web app to create a sheet and use that sheet to read and write data.

This is what i did

   function getCustomSpreadsheet(){
        //try to get the spreadsheet id of the already created spreadsheet
        var ssid = PropertiesService.getUserProperties().getProperty('customSsid');
        //if sheet does not exist, create it
        if(!ssid) var ssid = createCustomSpreadsheet();
        var ss = SpreadsheetApp.openById(ssid);
        return ss;
   }

   function createCustomSpreadsheet(){
        //make a copy of your template spreadsheet and save its id to a property
        fileId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";//your ss id here
        var ss = DriveApp.getFileById(fileId).makeCopy();
        var ssid = ss.getId();
        PropertiesService.getUserProperties().setProperty('customSsid', ssid);
        return ssid;
  }

      




I've found / replaced everywhere in my code SpreadsheetApp.getActiveSpreadsheet()

before getCustomSpreadsheet()

and lived happily ever after ...

+1


source







All Articles