试图使用谷歌应用程序脚本将xls转换为谷歌电子表格,并获得“空白响应”错误 [英] trying to convert xls to google spreadsheet using google app script and getting "Empty response" error
本文介绍了试图使用谷歌应用程序脚本将xls转换为谷歌电子表格,并获得“空白响应”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用以下代码将xls文件转换为Google电子表格:
I'm trying to convert a xls file to a google spreadsheet with the following code:
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错误...
But i'm getting "Empty response" error on Drive.Files.insert line...
我在做什么错了?
推荐答案
我终于可以使用copy了:
I finally get it to work using copy:
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});
这篇关于试图使用谷歌应用程序脚本将xls转换为谷歌电子表格,并获得“空白响应”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文