【发布时间】:2017-09-13 23:01:33
【问题描述】:
我正在尝试将数据从谷歌表格中的单个单元格提取到网页。到目前为止,我有这样的事情:
function loadPrice() {
var url="mygooglesheetslink";
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4 && xmlhttp.status==200){
document.getElementById("price").innerHTML = xmlhttp.responseText;
}
};
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
<body onload="loadPrice()">
<div id="price"></div>
</body>
它将工作表中的所有内容都拉到页面中,我只是想弄清楚如何将工作表中的单元格值单独放置在页面上的特定位置。
提前感谢您的帮助!
【问题讨论】:
-
你为什么不使用
google.script run.withSuccessHandler().somegasfunction记录的here。它非常易于使用。你可以在你的项目中调用任何谷歌应用脚本。
标签: javascript html google-sheets google-api