Last active
June 1, 2020 02:45
-
-
Save ttsukagoshi/ebd721b498a12e0e0227d06d14ef608a to your computer and use it in GitHub Desktop.
Google App Script function to create a Google Spreadsheet in a particular Google Drive folder
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 to create a Google Spreadsheet in a particular Google Drive folder | |
| * @param {Object} targetFolder - Google Drive folder object in which you want to place the spreadsheet | |
| * @param {string} ssName - name of spreadsheet | |
| * @return {string} ssId - spreadsheet ID of created spreadsheet | |
| */ | |
| function createSpreadsheet_(targetFolder, ssName) { | |
| var ssId = SpreadsheetApp.create(ssName).getId(); | |
| var temp = DriveApp.getFileById(ssId); | |
| targetFolder.addFile(temp); | |
| DriveApp.getRootFolder().removeFile(temp); | |
| return ssId; | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A Google Docs version of this script will be: