-
-
Save palumbo/d81f9541a8ee0829420c97a2a55936c3 to your computer and use it in GitHub Desktop.
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); | |
}; | |
} | |
} |
@vilas-92 you're welcome. Thanks for using it!
Hi
Can you make a script with prompt for making folder names and then make folder names with the prompt. I have made a bat exe which runs on command prompt, it asks for
- Deal Number
- Deal Name
- Seller
- Customer
Based on above information, Parent folder is created with
Parent folder - "Deal Number" + "Deal Name", under this
1st Folder is "Deal Number"+"Deal Name"+"Customer" then "Deal Number"+"Loading Pics"
2nd folder "Seller" then "Deal Number"+"Loading Pics" and "Material Pics"
Loading Pics and Material Pics is static.
In the 2nd folder, a xlsx file is copied and renamed to "Deal Number"+"Shipping Instructions".xlsx
This script can be run on a windows system only, I am planning to shift to chromebook, so I want a script which is platform independent.
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.
thanks for shearing code