Skip to content

Instantly share code, notes, and snippets.

@anemitz
Created April 21, 2016 13:22
Show Gist options
  • Save anemitz/8cc6ef6c41ea4cefe51a13fbd6d8676a to your computer and use it in GitHub Desktop.
Save anemitz/8cc6ef6c41ea4cefe51a13fbd6d8676a to your computer and use it in GitHub Desktop.
Google Sheets Fetch JSON with Authentication
function ImportJSONBasicAuthentication(url, query, parseOptions, username, password) {
var fetchOptions = {
"headers" : {
"Authorization" : 'Basic ' + Utilities.base64Encode(username + ':' + password)
},
muteHttpExceptions: true
};
return ImportJSONAdvanced(url, fetchOptions, query, parseOptions, includeXPath_, defaultTransform_);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment