Skip to content

Instantly share code, notes, and snippets.

@rheajt
Last active September 6, 2018 06:33
Show Gist options
  • Select an option

  • Save rheajt/67cb0d720cae545ffe48d4918584ccf7 to your computer and use it in GitHub Desktop.

Select an option

Save rheajt/67cb0d720cae545ffe48d4918584ccf7 to your computer and use it in GitHub Desktop.
copy filenames into documents on google drive
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);
}
}
@akhilshuklaji
Copy link
Copy Markdown

can it be used to copy names of available forms in a folder to other doc file in the drive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment