【问题标题】:Docx to Google Doc using Google ScriptDocx 到 Google Doc 使用 Google Script
【发布时间】:2015-06-03 09:01:24
【问题描述】:

我有很多 docx 文件(~72),它们的 MIMETYPE 是:

application/vnd.openxmlformats-officedocument.wordprocessingml.document 

我想将它们全部转换为 GoogleDocument,这样我就可以在线编辑它们,所以我需要它们

application/vnd.google-apps.document

这可能吗?我已经尝试过使用 blob 但没有任何效果,有办法创建一个具有相同格式的新 google doc 吗?

【问题讨论】:

    标签: google-apps google-docs-api


    【解决方案1】:

    知道了。

    var docx = DriveApp.getFileById("###");
    var newDoc = Drive.newFile();
    var blob =docx.getBlob();
    var file=Drive.Files.insert(newDoc,blob,{convert:true});
    

    {convert:true} 转换它。

    Ps : 您需要设置文档名称,因为它不包含在 blob 中

    DocumentApp.openById(file.id).setName(docx.getName());
    

    【讨论】:

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