Google 脚本 - 运行 在 Google 文档上
Google Script - Running on Google Docs
我想从 Google 文档部署 Google 脚本项目,其中 Google 文档中的文本显示在 index.html 的特定区域文件。有什么办法吗?我会很好奇学习的。
<html>
<h1> Header </h1>
[Google Document Code Goes Here.]
</html>
这是一个简单的对话框,可将 google 文档中的文本显示到 html 对话框中的文本区域标签。
function displaytestintextarea() {
const doc = DocumentApp.getActiveDocument();
const body = doc.getBody();
const text = body.getText();
DocumentApp.getUi().showModelessDialog(HtmlService.createHtmlOutput(`<textarea row="25" cols="50">${text}</textarea>`),"Text in TextArea");
}
在这种情况下,不需要提供完整的 html。
您可以将其调整为任意大小。
我想从 Google 文档部署 Google 脚本项目,其中 Google 文档中的文本显示在 index.html 的特定区域文件。有什么办法吗?我会很好奇学习的。
<html>
<h1> Header </h1>
[Google Document Code Goes Here.]
</html>
这是一个简单的对话框,可将 google 文档中的文本显示到 html 对话框中的文本区域标签。
function displaytestintextarea() {
const doc = DocumentApp.getActiveDocument();
const body = doc.getBody();
const text = body.getText();
DocumentApp.getUi().showModelessDialog(HtmlService.createHtmlOutput(`<textarea row="25" cols="50">${text}</textarea>`),"Text in TextArea");
}
在这种情况下,不需要提供完整的 html。
您可以将其调整为任意大小。