Created
October 4, 2015 02:19
-
-
Save revolunet/f2ac1755cec306596dcb to your computer and use it in GitHub Desktop.
gapps execution api example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// creds.json is a service account json key | |
// | |
// -> always getting "The caller does not have permission" | |
// | |
var script = google.script('v1'); | |
var key = require('./creds.json'); | |
var jwtClient = new google.auth.JWT(key.client_email, null, key.private_key, ['https://www.googleapis.com/auth/spreadsheets'], null); | |
jwtClient.authorize(function(err, tokens) { | |
if (err) { | |
console.log(err); | |
return; | |
} | |
script.scripts.run({ | |
auth: jwtClient, | |
scriptId: 'script-id', | |
resource: { | |
function: 'test', | |
parameters: [] | |
} | |
}, function(err, response) { | |
if (err) { | |
throw err; | |
} | |
console.log('response', response); | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment