尝试使用谷歌应用程序脚本将xls转换为谷歌电子表格并获得"空响应"错误

时间:2017-06-01 23:57:35

标签: excel google-apps-script google-sheets drive

我尝试使用以下代码将xls文件转换为google电子表格:

  var searchFor ="fullText contains 'theFile.xls' and '" + FolderId + "' in parents";  
  var files = DriveApp.searchFiles(searchFor); 
  var file = files.next().getBlob();  
  var convertedFileinfo = {
    title: 'theFile',
    parents:[{id: FolderId}]
  };
  Drive.Files.insert(convertedFileinfo, file, {
    convert: true,
    uploadType:'resumable'
  })

但我得到了#34;空的回应" Drive.Files.insert行错误...

我做错了什么?

2 个答案:

答案 0 :(得分:0)

如何改变?

来自:

Drive.Files.insert(convertedFileinfo, file, {
  convert: true,
  uploadType:'resumable'
})

收件人:

Drive.Files.insert(convertedFileinfo, file, {
  convert: true
})

答案 1 :(得分:0)

我终于使用副本了解它:

  var searchFor ="fullText contains 'theFile.xls' and '" + FolderId + "' in parents"; 
  var files = DriveApp.searchFiles(searchFor); 
  var xlsFile = files.next();    
  Drive.Files.copy({}, xlsFile.getId(), {convert: true});