在Google App脚本中以HTML格式获取google doc [英] get google doc as HTML in google app script
本文介绍了在Google App脚本中以HTML格式获取google doc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Google App脚本中以HTML格式获取Google文档?例如.我可以这样获取文档正文.
How can I get google doc as HTML in google app script? For example. I can get document body like so.
DocumentApp.getActiveDocument().getBody();
但是当我登录时,什么也没有.
But when I log it there is nothing.
推荐答案
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();
}
这篇关于在Google App脚本中以HTML格式获取google doc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文