PDF 模板存档
PDF Template Archiving
我已经创建了一个可以生成响应的表单 sheet。我还创建了一个 Doc,它是我的回复填写的模板。从这里它被转换成 PDF 并通过电子邮件发送给特定的收件人。我现在需要根据列答案将这些存档到特定文件夹中。我只是首先希望能够将它们移动或复制到特定文件夹中。这怎么可能。我使用了多个脚本,但看不到断开连接的位置。任何帮助将不胜感激。谢谢enter link description here
您可以尝试使用这样的代码:
function moveFileToFolder() {
var theFolder = DriveApp.getFolderById('your Folder ID');
var theFile = DriveApp.getFileById('Your File ID').makeCopy(theFolder);
var oldFileName = theFile.getName();
var archivedName = oldFileName.slice(5);
Logger.log('archivedName: ' + archivedName);
archivedName = "archive" + archivedName;
theFile.setName(archivedName);
}
要删除旧文件而不必将其发送到回收站:
//This requires the Drive API To be turned on in the Advanced Google Services.
//RESOURCES menu, ADVANCED GOOGLE SERVICES
function deleteFile(idToDLET) {
//idToDLET = 'the File ID';
//This deletes a file without needing to move it to the trash
var rtrnFromDLET = Drive.Files.remove(idToDLET);
}
我已经创建了一个可以生成响应的表单 sheet。我还创建了一个 Doc,它是我的回复填写的模板。从这里它被转换成 PDF 并通过电子邮件发送给特定的收件人。我现在需要根据列答案将这些存档到特定文件夹中。我只是首先希望能够将它们移动或复制到特定文件夹中。这怎么可能。我使用了多个脚本,但看不到断开连接的位置。任何帮助将不胜感激。谢谢enter link description here
您可以尝试使用这样的代码:
function moveFileToFolder() {
var theFolder = DriveApp.getFolderById('your Folder ID');
var theFile = DriveApp.getFileById('Your File ID').makeCopy(theFolder);
var oldFileName = theFile.getName();
var archivedName = oldFileName.slice(5);
Logger.log('archivedName: ' + archivedName);
archivedName = "archive" + archivedName;
theFile.setName(archivedName);
}
要删除旧文件而不必将其发送到回收站:
//This requires the Drive API To be turned on in the Advanced Google Services.
//RESOURCES menu, ADVANCED GOOGLE SERVICES
function deleteFile(idToDLET) {
//idToDLET = 'the File ID';
//This deletes a file without needing to move it to the trash
var rtrnFromDLET = Drive.Files.remove(idToDLET);
}