[英]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?
我正在使用 Apps 脚本构建一个网络应用程序。 在此 Web 应用程序中,我有一个表,需要从 OneDrive 中 Word 文档中的表填充。 本文档会定期更新,因此我更愿意以编程方式更新 Apps Script 中 html 表的内容。 这可能吗? 如果是这样,任何人都可以指导我如何实现这一目标吗?
我已经开始研究从 url 导入 xml,但我不确定我是否走在正确的轨道上。
OneDriveApp
html
文件中调用 Apps Script 函数样本:
代码.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;
}
索引.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.