【问题标题】:Ajax calls made from Google Spreadsheet Custom Function从 Google 电子表格自定义函数进行的 Ajax 调用
【发布时间】:2013-08-02 16:03:18
【问题描述】:

有没有人尝试在 Google 电子表格中编写脚本来对网站进行 ajax 调用?

我想让电子表格从网站上自行更新。但是在放了这么短的代码之后,我得到了一个错误:

"ReferenceError: "XMLHttpRequest" 未定义。"

有什么想法吗?我必须调用某个库吗?

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

【问题讨论】:

    标签: javascript ajax google-apps-script google-sheets google-sheets-api


    【解决方案1】:

    Google Apps 脚本本身不支持 XMLHttpRequest(),但正如您所怀疑的那样,有些服务可以完成同样的事情。

    查看UrlFetch ServicesClass Xml(已弃用)和Xml Services

    其中一个应用脚本教程 (Accessing Picasa Web Albums through Apps Script) 介绍了这些服务的使用,是您开始学习的好地方。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-10
      • 2015-07-06
      • 1970-01-01
      • 2015-09-21
      • 1970-01-01
      相关资源
      最近更新 更多