[英]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.