尝试使用 google 应用程序脚本将 xls 转换为 google 电子表格并出现 "Empty response" 错误

trying to convert xls to google spreadsheet using google app script and getting "Empty response" error

我正在尝试使用以下代码将 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'
  })

但我在 Drive.Files.insert 行收到 "Empty response" 错误...

我做错了什么?

接下来的变化如何?

发件人:

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

收件人:

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

我终于使用副本让它工作了:

  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});