【问题标题】:convert Google Docs to Docx using google script使用 google 脚本将 Google Docs 转换为 Docx
【发布时间】:2018-02-03 21:56:46
【问题描述】:

GoogleDoc 已创建并记录更改,但是,当我转换时,我得到一个空白文档 docx。我做错了什么?

var doc_id = DocumentApp.create('Sample Document').getId();
var doc = DocumentApp.openById(doc_id);
var body = doc.getBody();
var rowsData = [['Plants', 'Animals'], ['Ficus', 'Goat'], ['Basil', 'Cat']];
body.insertParagraph(0,'test');
table = body.appendTable(rowsData);
var file = Drive.Files.get(fileId);
var url = 'https://docs.google.com/feeds/download/documents/export/Export?id=' + fileId + '&exportFormat=docx';
var options = {
headers: {
  Authorization: "Bearer " + ScriptApp.getOAuthToken()
},
    muteHttpExceptions: true
}
var response = UrlFetchApp.fetch(url, options);
var doc = response.getBlob();
DriveApp.createFile(doc).setName(file.title);

【问题讨论】:

  • 它在 doc.saveAndClose();
  • 如果你发现你的错误,你应该添加一个答案

标签: google-apps-script ms-word google-api google-drive-api


【解决方案1】:

问题已解决!它在 doc.save And Close();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-01-13
    • 2021-12-15
    • 1970-01-01
    • 1970-01-01
    • 2020-12-08
    • 2021-05-21
    • 1970-01-01
    相关资源
    最近更新 更多