Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Script editor opening with wrong account from Google Sheets

I'm logged into several Google accounts and I'm editing a Google Sheet with one of them (in Firefox). I select Script editor from the Tools menu to create a script for the spreadsheet. Google Scripts creates a new script, but under one of the other Google accounts, not the one I'm using in Sheets. If I try to change account it tells me that account I'm switching to doesn't have permission to access the empty script it just created.

Does anyone know how to get the expected behaviour (Sheets and Script editor using the same login)?

like image 543
toby1kenobi Avatar asked Jun 19 '20 12:06

toby1kenobi


2 Answers

The first Google account that you log into in the browser is the default account, and that default account is given a number of zero. Then when you log into subsequent accounts, they are numbered with the next number. The account number is often put somewhere into the URL in the address bar.

For example, in Gmail:

https://mail.google.com/mail/u/0/#inbox - Default account
https://mail.google.com/mail/u/1/#inbox - Second account logged into

So, if you see a single digit number somewhere in the URL in the address bar, that may be the account associated with the account sequence that you logged in with. That is, if that app can detect multiple accounts and which one is associated with the current tab.

Unfortunately, Google Add-ons and the Apps Script code editor don't seem to be able to detect what account is associated with their browser tab. In other words, the code editor and add-ons don't "know" what account to use. This has been an ongoing issue for a long time.

If you want to be logged into multiple accounts, and still have the code editor work, then I'd log out of all accounts, and then the first account that you log back in to must be the account that you want the code editor to work with. And if you want the code editor to work with multiple accounts that you are logged into, I'm not sure if that is possible.

You can edit the URL in the address bar and change the account number at the end of the URL, but I don't think that the script URL has anything in the URL to indicate what account it's associated with.

If I'm wrong about something, or someone has better, more information please let us all know.

like image 138
Alan Wells Avatar answered Oct 20 '22 08:10

Alan Wells


I was able to create the script under the account that I want by navigating to https://script.google.com/u/0/home or https://script.google.com/u/1/home (depending on the account I need)

like image 21
wicccked Avatar answered Oct 20 '22 08:10

wicccked