Peter Meier
Peter Meier

Reputation: 1

How to copy or move a doc file to "my drive"

I am quite new in app script.. I found the way to move or copy a doc file to a dedicated folder on a drive (with the Id), but I did not find a way to put it on the home folder "My Drive". The "create" function does create the file in "My Drive" but I did not find a way to do it using "makecopy" or "moveto"

Any help would be highly appreciated :) Peter

I have tried to find if there is a "root" folder corresponding to "my drive". But I could not find it.

Upvotes: 0

Views: 35

Answers (1)

Cooper
Cooper

Reputation: 64110

function copyAFileToRootFolder() {
  const t = DriveApp.getFileById("fileid");//file to copy
  t.makeCopy(DriveApp.getRootFolder());
}

Upvotes: 0

Related Questions