Application or script that can generate folder structure + make a copy of a google sheet?

Joey Cumley

For my work, each time we bring on a new client we need to create a new folder structure in google drive (the same structure for every account) and in one folder we generate a copy of a google sheet that we have. This is rather time consuming, so was hoping there was a way to easily duplicate a google drive folder structure and have it make a copy of the google sheet that we include in one of the folders.

The perfect result would be to easily copy/duplicate an exact folder structure (obviously renaming it for the client) and then have the folder have the copy of the google sheet in the correct folder already

MetaMan

Creating a folder structure

function createClientAccountFolder(brandName) {
  //var brandName=brandName || 'BrandName';
  var Template1=DriveApp.getFileById('TemplateId');//You need to add the id of your template here
  var acctRoot=DriveApp.getFolderById('Accounts Root Folder Id');//you need to add the id of the root accounts folder here
  if(brandName) {
    var mainFldr=acctRoot.createFolder(Utilities.formatString('MainFolder-%s',brandName));
    var liveFldr=mainFldr.createFolder(Utilities.formatString('%s-Live',brandName));
    var editedFldr=mainFldr.createFolder(Utilities.formatString('%s-Edited',brandName));
    var imgsFldr=liveFldr.createFolder('Images');
    imgsFldr.createFolder('Ecommerce');
    imgsFldr.createFolder('LifeStyles');
    imgsFldr.createFolder('Model');
    Template1.makeCopy(liveFldr);
  }else{
    SpreadsheetApp.getUi().alert('No Brand Name Specified')
  }
}

You could enhance this script with a dialog that allows you to select different folders and possibly even add additional root account folders and the same with templates. But that is considerably more involved than what you have now.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Make a copy of google sheet into google drive folder

Gsheets Apps script: Make a copy of a Spreadsheet in a specific folder of Google Drive

Google Script to copy all csv files in a GDrive Folder as new sheets in existing 'master' Google sheet

Google App Script Copy a single sheet and create a new spreadsheet in specific folder

Google script Create new sheet file and move it to a specific folder Then copy the contents and 2 tabs from the active sheet to the newly created file

Windows batch script to copy files with folder structure

How can I make a 'google sheet script' or formula to change values in different cells based on a checkbox in the sheet

Automatically download Google Sheet into a specific folder by script

Revise google sheet script to copy values and not formulas

Google sheet script format changes before copy

Copy sheet to another spreadsheet [Google Apps Script]

Google Sheets script to copy a range to another sheet

Copy a Google sheet to multiple spreadsheets in a folder using the Folder ID

Can I use Google Apps Script to make a Google Form display randomized text from a Google Sheet?

Google Sheet Script to copy a a sheet to a new tab with values and not formulas

Google Script, how can I copy a row from Sheet1 to Sheet2 instead of just one cell by using regex?

Using Google Apps Script, how can I replace text in a Google Sheets template to make a new Sheet?

How can I copy a spreadsheet into specifc folder on GDrive using Google Script WITHOUT copying associated Form and Script

How to make a loop script for Google sheet?

How can i make a php script which will automatically generate links of my folder's file

Copy a sheet from a SpreadSheet file to a Google Drive folder

Google Script to Copy cells value to another Google sheet

How can I make a Google Sheet script run reliably on Samsung tablets?

Powershell script to copy folder structure and specific file types

How to copy a folder structure and make symbolic links to files?

google sheet script - writing back new sheet ID to cell, after copy sheet to new file

Compare data in source sheet with target sheet and copy missing rows to target sheet with Google Apps Script

Google Sheet (Script) copy Sheet to another SpreadSheet and name new sheet in target SS

How to Copy a data range from one sheet to another sheet using Google Sheet Script