Hi Kiron,
When you talk about "Tables" are you referring to Google Sheets, or something else?
If you are talking about google sheets then here are some starters for you to think about:
- Are you wanting the sub folder to be created as soon as someone enters a value in a particular column of the sheet (use an on_edit installable trigger), OR
- Can it wait to run on a timer(trigger) where multiple ones could be created (e.g. every hour) OR
- Do you want to run the script to do it when you are ready (create a menu item to do it)
- What happens if someone edits an already existing value in the same column? Do you want the system to rename the folder, or not?
Then practically speaking I would -
On the sheet itself:
- have a cell on your sheet at the top which is the root directory URL where you are going to put all the sub directories so you can reference it easily from your script (and also use it to open up the directory easily as well!)
- have at least 2 columns - one for the name (to be typed) and one for the url from the new directory
In the apps script:
- Create a script that will go through your 2 columns (and get the root folder from the sheet)
- Add in the code below to get the ID of a folder/document/sheet from a URL [BONUS!}
- Use this guys help with whichever difficulty level you need to create your folders in your root one
- As you loop through the 2 columns, ignore rows that already have a URL and only create folders for ones with a name but not URL
- Finally - use your range to get the row/cell for the URL and .setValue(newURL) to the newly created folder
Hope this gets you started. There's lots of help out there to get a range of values from a sheet.
Laurie
Bonus code that I use A LOT!!!
// get the ID from a url for use later....
function getIdFromUrl(url) {
return url.match(/[-\w]{25,}/);
}