Created
August 5, 2023 16:50
-
-
Save palumbo/d81f9541a8ee0829420c97a2a55936c3 to your computer and use it in GitHub Desktop.
This Google Apps Script creates folders and files in Google Drive based on values in Google Sheets
This file contains 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 myFunction() { | |
// Spreadsheet Variables | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
var sheet = ss.getActiveSheet(); | |
var lastRow = sheet.getLastRow(); | |
// Google Drive Variables | |
var rootFolder = DriveApp.getFolderById("1oqHxYeC8wC0ufJ8WPtq4WKfoJDqulppB"); | |
// Logger.log(lastRow); << 18 | |
for ( var i = 1; i < lastRow; i++ ) { | |
// create folder | |
let title = sheet.getRange(i,1).getValue(); | |
let description = sheet.getRange(i,7).getValue(); | |
if ( title != "title") { | |
var folderId = rootFolder.createFolder(title).getId(); | |
var folder = DriveApp.getFolderById(folderId); | |
// Logger.log('Folder Name: ' + title + ' Folder ID ' + folderId); | |
var docID = DocumentApp.create(title).getId(); | |
var document = DocumentApp.openById(docID); | |
var paragraph = document.getBody().appendParagraph(description); | |
DriveApp.getFileById(docID).moveTo(folder); | |
}; | |
} | |
} |
I used the Yu.prompt and the values are coming, how to use these to create
folder, can you send a example
…On Wed, Aug 14, 2024 at 9:38 AM Joseph Palumbo ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
Hi @amitm020 <https://github.com/amitm020>, yes, you can use ui.prompt to
get input from a user, then use that input as a value/parameter in your
code.
Everything you currently do with your bat script can be duplicated with
Apps Script.
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/palumbo/d81f9541a8ee0829420c97a2a55936c3#gistcomment-5154043>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BKRBNADCI3RU2FLB73LIGPDZRNMVDBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTEMZYHEYDSMJUU52HE2LHM5SXFJTDOJSWC5DF>
.
You are receiving this email because you were mentioned.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @amitm020, yes, you can use
ui.prompt
to get input from a user, then use that input as a value/parameter in your code.Everything you currently do with your bat script can be duplicated with Apps Script.