【问题标题】:Import google spreadsheet data to google doc app script将谷歌电子表格数据导入谷歌文档应用脚本
【发布时间】:2015-06-10 15:36:43
【问题描述】:

我正在尝试使用谷歌应用脚​​本将谷歌电子表格数据导入谷歌文档。我在检查 API 方面没有找到任何帮助。是否可以将数据导入文档?那怎么办?

【问题讨论】:

  • 您想要电子表格的图像吗?您是否想要 Doc 中的表格,其中包含电子表格中的数据?您想要在 Google Doc 中工作的电子表格吗?您可以从电子表格中获取数据,并使用代码在 Doc 中创建表格。
  • 我有一个带有数据和图表的谷歌电子表格,想在谷歌 word 文档上绘图。
  • 那么,您想将图表放入 Google Doc 中吗?不是实际数据?
  • 是的,我需要把图表放在 google word doc 上
  • 图片可以插入到文档中。我在插入图表的文档中看不到任何内容。您可能需要将图表转换为图像,然后插入图像?您可以“手动”插入图表。

标签: google-apps-script


【解决方案1】:
 function createDocFromSheet(){
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet =  ss.setActiveSheet(ss.getSheets()[2]);

  var values = ss.getDataRange().getValues()
for(n=2;n<=values.length;++n){
  var cell = sheet.getRange(n,3).getValue();
    var row = sheet.getRange(n,2,1,5).getValues();
var newDoc = DocumentApp.create(cell);
 var body = newDoc.getBody();
  body.insertParagraph(0,row);
 newDoc.saveAndClose(); 
}
}

【讨论】:

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