在谷歌应用脚​​本中将.xls转换为谷歌电子表格

Bur*_*hik 8 google-sheets google-apps-script google-drive-api

我有一个存储在Google云端硬盘中的.xls文件.我想将其从Google Apps脚本转换为Google表格电子表格文件格式.没有外部解决方案,有没有办法做到这一点?

Riy*_*eed 7

现在可以使用高级驱动器服务:

https://developers.google.com/apps-script/advanced/drive

使用Drive.Files.insert时,只需将可选参数"convert"设置为"true"即可.

var file = {
    title: 'Converted Spreadsheet'
  };
  file = Drive.Files.insert(file, xlsxBlob, {
    convert: true
  });
Run Code Online (Sandbox Code Playgroud)

这也是从上面给出的问题中获得的

  • 您还可以通过向Drive.Files.insert提供"parents"参数来设置目标文件夹.像这样:`parent:[{"kind":"drive#parentReference","id":"folder id"}]` (3认同)

Joe*_*ley 3

除了使用提供的“上传”和转换功能之外,目前尚不可用。在此处请求增强请求:http://code.google.com/p/google-apps-script-issues/issues/detail? id=1019