sanu paul
sanu paul

Reputation: 21

Google sheets Scripts not working in shared links

I am new to google sheets and scripts. I have created a searchable product list in google sheet and created a button clear the contents(not the formulas). Everything will work fine when I logged in. If i share the link with someone the script is not working and showing an error. The sheet is perfectly working.

function myFunction() {

    var sheet = SpreadsheetApp.getActiveSheet();
    var rangeList = sheet.getRangeList(['A8', 'E24']);
    rangeList.clear({contentsOnly: true});

}

Is there any way to resolve this, please?

Upvotes: 1

Views: 1421

Answers (1)

Sourabh Choraria
Sourabh Choraria

Reputation: 2331

What you want to achieve is sadly not possible :( Please refer to Authorization for Google Services.

In line one of the documentation, you'll find -

Apps Script requires user authorization to access private data from built-in Google services or advanced Google services.

Given that you're using SpreadsheetApp service to access Sheets, a user needs to be logged in for the script functions to do as required.

Hope this clarifies.

Upvotes: 1

Related Questions