Skip to content

Instantly share code, notes, and snippets.

@codeas
codeas / gas-google-nlp.js
Created March 6, 2018 21:51
GAS Google NLP
/*
* Get sentiment from Google Cloud Natural Language API
*/
var getSentiment = function(text) {
var apiKey = PropertiesService.getScriptProperties().getProperty("apiKey")
var url = "https://language.googleapis.com/v1/documents:analyzeSentiment?key=%KEY".replace("%KEY", apiKey)
var data = {
document: {
language: "en-us",