【问题标题】:Google Apps Script -> write Text from Document to SheetGoogle Apps 脚本 -> 将文本从文档写入工作表
【发布时间】:2014-11-14 22:23:47
【问题描述】:

我得到了一个 Google 文档,并通过 GAS 将它与另一个 Google 表格中的多个数据(数字以及长文本)一起提供。 插入后,我修改了一些导入的文本,存储在不同的段落 -> DocumentApp.getActiveDocument().getBody.appendParagraph('...') 中。完成此修改后,我想将修改后的文本安全地放回我的工作表,但我没有胶水如何做到这一点。

有人可以帮我解决这个问题吗?

非常感谢,祝你有美好的一天。

【问题讨论】:

  • 如果您已经能够从文档读取并写入电子表格,为什么不能从工作表读取并回写到文档?!你正面临什么样的困境?
  • 不不,完全相反。我能够从工作表中读取并写入文档,但不能向后执行。那就是问题所在。 :)
  • DocumentApp.getActiveDocument() ?
  • 是的,但这只是文档本身。如何访问文档中的特定段落?我想将这些文本写回工作表,但不知道该怎么做。
  • DocumentApp.getActiveDocument().getBody().getParagraphs() ?

标签: google-apps-script google-docs google-spreadsheet-api


【解决方案1】:

使用DocumentApp.getActiveDocument().getBody().getParagraphs(),您可以访问文档的段落。当然,您可以将DocumentApp.getActiveDocument() 替换为您正在处理的文档的引用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多