How to copy a file into a specific folder using DocsList?

前端 未结 4 1679
萌比男神i
萌比男神i 2020-12-22 04:47

I am trying this code to copy a Google spreadsheet into a specific folder

var targetFolder = DocsList.createFolder(\"Testing\");
var mainDocBlob = DocsList.g         


        
4条回答
  •  暖寄归人
    2020-12-22 05:12

    Below is the code that should work. I'm guessing when you get as a blob it.s defaulting to casting the new file as pdf. In the code below makeCopy is defaulting to making the new file name 'Copy of ...' but this can be set by a string.

    var targetFolder = DocsList.createFolder("Testing");
    var mainDoc = DocsList.getFileById("docId");
    mainDoc.makeCopy().addToFolder(targetFolder);
    

提交回复
热议问题