html - 在谷歌应用脚​​本中将谷歌文档作为 HTML 获取

标签 html google-apps-script google-docs

<分区>

如何在谷歌应用程序脚本中将谷歌文档作为 HTML 获取? 例如。我可以像这样获取文档正文。

DocumentApp.getActiveDocument().getBody();

但是当我登录时什么也没有。

最佳答案

function doc_to_html()
{
 var id = document_Id;
 var url = "https://docs.google.com/feeds/download/documents/export/Export?id="+id+"&exportFormat=html";
 var param = 
        {
          method      : "get",
          headers     : {"Authorization": "Bearer " + ScriptApp.getOAuthToken()},
          muteHttpExceptions:true,
        };
 var html = UrlFetchApp.fetch(url,param).getContentText();
}

关于html - 在谷歌应用脚​​本中将谷歌文档作为 HTML 获取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29918280/

相关文章:

html - 具有相同大小子元素的 CSS Flexbox

html - 降低文本框高度

html - 字体在 Firefox 中无法正常显示

javascript - Sweet Alert with form JS (3 input)

google-apps-script - 将 Google Docs 文件批量转换为 Microsoft Word

google-apps-script - 以编程方式在 Google 电子表格图表中设置最小值

javascript - 在 google sheet JavaScript 中添加一行

google-apps-script - appmaker 中的 Accordion

php - 如何使用 Google Docs for Mailer 模板?

javascript - 如何省略 json 的属性名称并仅显示值?