Using an app password to access Google Apps Script Via Google Sheets

57 views
Skip to first unread message

Orr Bildner

unread,
Jun 24, 2022, 9:21:13 AMJun 24
to Google Apps Script Community

Hi all,

I have a Google Sheets file with an associated Google Apps Script file in which I defined some functions used in the Sheet, to access another Google Sheets file in my Google Drive.

This stopped working due to Google's recent change in supporting Less Secure Apps.

I was able to generate an app password but not sure where exactly I'm supposed to plug it in. 

I tried both logging out of my account and logging in again (via Google Sheets) with this app password, as well as inputting it when I'm asked to authorize the specific function run, from inside Google Apps Script. Neither worked.

Any ideas?


Jonathan Butler

unread,
Jun 24, 2022, 11:27:18 AMJun 24
to google-apps-sc...@googlegroups.com
Are you trying to access just the functions from your other account? Or are you also trying to access data on your other account, with that account's permissions? If it is the former, I suggest using a library. If it is the latter, I suggest using a web app and a secret string to send when reading information.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/cde46259-0ad1-42f0-9aee-3b810ec3d0fan%40googlegroups.com.

Orr Bildner

unread,
Aug 4, 2022, 8:45:59 AM (10 days ago) Aug 4
to Google Apps Script Community
I created 2 spreadsheets on my account. Then I'm trying to use google apps script in one of them, to grab some data (some cells, ranges) from the other spreadsheet.
This used to work but stopped working, whenever I try running the script from within the spreadsheet, it tells me the app is blocked.
I think I need to use an app password but not sure where I'm supposed to plug it in.
Somewhere inside the script?

ב-יום שישי, 24 ביוני 2022 בשעה 18:27:18 UTC+3, butlerjon...@gmail.com כתב/ה:

Orr Bildner

unread,
Aug 4, 2022, 10:13:31 AM (10 days ago) Aug 4
to Google Apps Script Community
I was able to overcome this issue with the help of this workaround:
ב-יום חמישי, 4 באוגוסט 2022 בשעה 15:45:59 UTC+3, Orr Bildner כתב/ה:

CBMServices Web

unread,
Aug 4, 2022, 2:25:43 PM (10 days ago) Aug 4
to google-apps-sc...@googlegroups.com
Hi Orr,

 You don't need a password if you setup the app correctly.  First, make sure you have edit access to both Spreadsheets.  Then make sure the script has the right scope for accessing the spreadsheets. Best way to do this is run the script manually then go through the authorization and approve it. Another way to do that is to add the scopes in the manifest file (but much easier to just run the script manually to ensure the scopes are added correctly to the manifest file).

 

Reply all
Reply to author
Forward
0 new messages