First of all I have spreadsheet with app script bundled to it.
- I have an api built in node.js and I am using drive api to create a copy of my spreadsheet.
- I share that file with a user for whom the copy was actually created and give him 'editor' permissions.
- When user opens shared spreadsheet, bundled script doesn't work. None of the triggers work (onEdit, onOpen..).
I also use sheets api in between to populate sheets with list of options (from db) but that doesn't matter now. That part works fine.
If I open original file bundled script works fine.
Thanks in advance for ur help.
Update - additional explanation (@Tanaike): If I create a copy directly on google drive, it works, even if one of my colleagues opens it.
Detailed explanation (node.js part):
await drive.files.copy(params)
- creates a copy of a spreadsheet, these are the paramsconst params = { fileId: id, resource: { name: test }, supportsAllDrives: true, }
await drive.permissions.create({ fileId: id, requestBody: { emailAddress: user.email, role: 'writer', type: 'user', }, })
This gives him writer (editor) permissions.
When that user opens this spreadsheet, apps script doesnt work. I can open it from Extensions -> apps script, but none of the triggers work (onEdit, onOpen..).
Note that I am using Google Drive API and Simple Triggers in the Apps Script. + Service account