I’m attempting to use Google Docs’ ability to run scripts to create the necessary folder structure for new clients (to upload content/images into). Here’s what I have thusfar:
/**
* This script creates the necessary folder structure for a new client
*/
function newClientSetup() {
var initial = DocsList.getFolder("Clients");
var client = DocsList.addtoFolder.createFolder("Client Name");
var file = DocsList.addtoFolder(client);
};
Now this is not working (TypeError: Cannot call method "createFolder" of undefined. (line 7)), but I’m having trouble figuring out how to use the Folder class within DocList. I saw that DocsList has a createFolder method, that I could use like:
var folder = DocsList.createFolder("Folder Name");
but I’m trying to start off with a parent folder, called Clients (already in Google Docs) and then create the following structure:
Clients
Client Name
Content
Images
Ideally I could run this script, but pass in a variable for Client Name to actually create the client name, but I haven’t found much help from the docs. Any suggestions? Thanks!
Here is an example of how it works, see comments :
to test this function simply use something like this :
note : to get the ID of your folder, take the value right behind folders/ in the url of the folder. Example in bold : https://drive.google.com/?hl=fr&tab=wo#folders/0B3qSFxxxxxxxxxdsMTFZMDQ
The sequence might be much longer if you have more folder levels… but the structure is always the same and is unique for every folder.