Ajax calls from Google Spreadsheet custom function

Hey guys, have any of you ever tried to write a script inside Google Spreadsheet to make an ajax call to a website. I want to make the spreadsheet updated from the website. But after I put this short block of code, I got an error: "ReferenceError:" XMLHttpRequest "not defined". Any help guys? Do I need to call a specific library?

xmlhttp=new XMLHttpRequest(); xmlhttp.open("GET", eventObject[1], true); xmlhttp.send(); 
+4
source share
1 answer

Google Apps Script does not support XMLHttpRequest() natively, but, as you suspected, there are services that can do the same thing.

See UrlFetch Services , Xml Class (deprecated), and Xml Services .

One of the Script application tutorials ( Accessing Picasa Web Album via Script Applications ) covers using these services and be a good place for you.

+5
source

Source: https://habr.com/ru/post/1494991/


All Articles