最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Ajax calls made from Google Spreadsheet Custom Function - Stack Overflow

programmeradmin0浏览0评论

Has anyone ever tried to write a script inside a Google Spreadsheet to make an ajax call to a website?

I want to make it so that the spreadsheet updates itself from the website. But after just putting this short block of code, I get thrown an error:

"ReferenceError: "XMLHttpRequest" is not defined."

Any idea? Do I have to call a certain library?

xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET", eventObject[1], true);
xmlhttp.send();

Has anyone ever tried to write a script inside a Google Spreadsheet to make an ajax call to a website?

I want to make it so that the spreadsheet updates itself from the website. But after just putting this short block of code, I get thrown an error:

"ReferenceError: "XMLHttpRequest" is not defined."

Any idea? Do I have to call a certain library?

xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET", eventObject[1], true);
xmlhttp.send();
Share Improve this question edited Oct 29, 2020 at 8:55 peterh 1 asked Aug 2, 2013 at 16:03 user2577475user2577475 1712 gold badges2 silver badges6 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 16

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

Look at UrlFetch Services, Class Xml (deprecated) and Xml Services.

One of the apps script tutorials (Accessing Picasa Web Albums through Apps Script) covers the use of these services, and would be a good place for you to start.

发布评论

评论列表(0)

  1. 暂无评论