I am using the script editor in google spreadsheets, and I want to be able to make a simple HTTP request, but I keep getting the following error message:
Google Apps Script: You do not have permission to call fetch
I used the onEdit
Function
function onEdit(e){
var ui = SpreadsheetApp.getUi();
var response = UrlFetchApp.fetch('http://www.google.com/');
Logger.log(response.getContentText());
}
Why am I getting this error? Any help would be appreciated.
Simple triggers cannot use functionality that requires authorization Rename the function, then create an installed onEdit
trigger for it. Call it manually within the Script Editor, proceed through the Authorization flow, and then the functionality will work as you expect.
Note that for things with quotas (such as UrlFetch), you may want to gate the call behind range checks, etc. (i.e. is event.range.getColumn()
a desired value, etc).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With