Google apps script 如何替换不推荐使用的DocsList服务?
自2015年4月20日起,DocsList服务“服务不再运行”。我有此功能此功能使用docsList服务:Google apps script 如何替换不推荐使用的DocsList服务?,google-apps-script,google-sheets,Google Apps Script,Google Sheets,自2015年4月20日起,DocsList服务“服务不再运行”。我有此功能此功能使用docsList服务: /** * Duplicates a Google Apps doc * * @return a new document with a given name from the orignal **/ function createDuplicateDocument(sourceId, name) { var source = DocsList.getFileById(s
/**
* Duplicates a Google Apps doc
*
* @return a new document with a given name from the orignal
**/
function createDuplicateDocument(sourceId, name) {
var source = DocsList.getFileById(sourceId);
var newFile = source.makeCopy(name);
var targetFolder = DocsList.getFolderById(TARGET_FOLDER);
newFile.addToFolder(targetFolder);
return DocumentApp.openById(newFile.getId());
}
如何在此createDuplicateDocument
功能中替换DocsList
服务?以下是新方法:
function createDuplicateDocument(sourceId, name) {
//var source = DocsList.getFileById(sourceId);
var source = DriveApp.getFileById(sourceId);
var newFile = source.makeCopy(name);
//var targetFolder = DocsList.getFolderById(TARGET_FOLDER);
var targetFolder = DriveApp.getFolderById(TARGET_FOLDER);
//newFile.addToFolder(targetFolder);
targetFolder.addFile(newFile);
return DocumentApp.openById(newFile.getId());
};
@ZigMandel-我想你是指这篇评论的OP。。。你肯定不希望桑迪那样做!是的,对不起!我讨厌手机应用:)