[英]Is it possible to import XML or JSON data from a table within a Word online document into Apps Script website as an HTML table?
I am building a web app using Apps Script.我正在使用 Apps 脚本构建一个网络应用程序。 In this web app I have a table that needs to be populated from a table in a Word doc in OneDrive.
在此 Web 应用程序中,我有一个表,需要从 OneDrive 中 Word 文档中的表填充。 This document is updated regularly, so I would prefer to programmatically update the content of the html table in Apps Script.
本文档会定期更新,因此我更愿意以编程方式更新 Apps Script 中 html 表的内容。 Is this possible?
这可能吗? If so, can anyone give me guidance as to how to accomplish this?
如果是这样,任何人都可以指导我如何实现这一目标吗?
I've started looking into importing xml from a url, but I'm not sure that I'm on the right track.我已经开始研究从 url 导入 xml,但我不确定我是否走在正确的轨道上。
OneDriveApp
as recommended by CooperOneDriveApp
html
filehtml
文件中调用 Apps Script 函数Sample:样本:
code.gs
代码.gs
function doGet(){
return HtmlService.createHtmlOutputFromFile('index');
}
function getFreshData(){
//read here your Word Doc data, e.g. with One DriveApp and store it e.g. in an array
...
return myDataArray;
}
index.html
索引.html
...
<body onload="polling()">
...
<script>
function polling(){
setInterval(myFunction,2000); //chose how often you want your table
}
function myFunction(){
google.script.run.withSuccessHandler(onSuccess).getFreshData();
}
function onSuccess(myDataArray){
// Create a html table with the freshly obtained myDataArray from the Word Doc
...
}
</script>
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.