此代碼復制給定檔案,為其指定一個新名稱并將其移動到目的地。
DriveApp.getFileById(fileId).makeCopy(fileName,fileDestination)
當我將所有檔案都放在共享驅動器上時,我如何才能擁有相同的功能?我已經激活了 Drive API,除了上面的代碼,一切正常!
uj5u.com熱心網友回復:
嘗試改用此代碼:
function copytoMyDrive(){
var destinationMyDriveId = "yourdestinationfolderid in my Drive";
var sheet = "your sheet ID";
Drive.Files.copy({title:'Copy of file',parents:[{id:destinationMyDriveId}]},sheet, {supportsAllDrives: true})
}
如果您希望復制的檔案具有不同的名稱,則 title 引數是可選的。運行代碼后,您應該在“我的云端硬碟”中指定檔案夾中的共享云端硬碟中擁有該檔案的副本。
參考:
- 檔案:復制
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/464920.html
