The folders have a consistent naming convention:
- SURNAME, Forename (Preferred Forename) (Student No) (Username) - Subject
Example folders to extract details from |
Extracted details in spreadsheet |
Start with the folder ID of the parent that contains all of the sub-folders to query 'getFolders'. I then work through each sub-folder in turn 'hasNext' to 'getId' and store this as a variable. We next need to 'getName' so it can be split via a regex (explained in this blog post) to get the surname, forename and username.
An array of the above data is then created and passed through to the below function for copying into the spreadsheet.
2) pasteData
With an array of data as the input parameter we simply get the relevant spreadsheet details and the next empty row ('getLastRow'). As there are 4 pieces of data we set the dimensions of the range to 4 columns and then finally 'setValues'.
Get existing Folder IDs/Names.xlsx
No comments:
Post a Comment