Last active
September 6, 2018 06:33
-
-
Save rheajt/67cb0d720cae545ffe48d4918584ccf7 to your computer and use it in GitHub Desktop.
copy filenames into documents on google drive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function copyTitles() { | |
| var folderId = '0Byvt4e0JQrRAMVR2Z0dnZnVhcDA'; | |
| var folder = DriveApp.getFolderById(folderId); | |
| var files = folder.getFilesByType(MimeType.GOOGLE_DOCS); | |
| while(files.hasNext()) { | |
| var file = files.next(); | |
| var fileId = file.getId(); | |
| var fileName = file.getName(); | |
| DocumentApp.openById(fileId).getBody() | |
| .insertParagraph(0, fileName) | |
| .setAlignment(DocumentApp.HorizontalAlignment.CENTER) | |
| .setHeading(DocumentApp.ParagraphHeading.HEADING1); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can it be used to copy names of available forms in a folder to other doc file in the drive