Moving Files In Google Drive Using Google Script

前端 未结 8 1458
终归单人心
终归单人心 2020-12-03 05:15

I\'m trying to create documents using information posted through Google forms, then once the document is created I would like to move the document into a shared folder for p

8条回答
  •  鱼传尺愫
    2020-12-03 06:11

    This is my first post! I know this has been answered a few times, but I actually came across this question while working on my project, and while reviewing the Apps Script documentation, I figured out a concise way to do it. A variation of some1's answer.

    var file = DriveApp.getFileById(fileid);
    DriveApp.getFolderById(folderid).addFile(file);
    DriveApp.getRootFolder().removeFile(file);
    

    Hope it helps!

提交回复
热议问题