A webapp to share copies of the contents of folders


If you want to share files with people that are new to Google Drive there can be some conceptual challenges with the sharing paradigm.
When you use Google Docs sharing, you are sharing the document itself, which is great for collaboration but non so good for distribution. For things like scripts , you probably want people to make a copy of what you are sharing so they can go ahead and edit their own copy.

CopyFolder is an easy way to distribute a link which will make a copy of the of the contents of a folder, so the the recipient starts with their own copies of the files on their own drive. I find this a much handier way to distribute Apps Script source code than simply sharing a link to the script, and when I use Github the script has to be constructed from source - and the user has to know how to pull stuff from github. 

So all in all, just sending a link which makes copies in the users Drive seems like an ideal way to distribute assets.

Here's a video on how to share your own assets.


The CopyFolder webApp does that. It takes 2 parameters
 Parameter Usage
 sourceid The source folder id
 target The target folder name. It will create it if necessary


Of course the contents and the folder should be accessible by the person trying to make the copy, but the main usage would anyway be to share public files.

Let's say I want to share the contents of the folder that contains some insrtuctions and source of copyFolder so that you have your own copy to edit. I don't want to share my documents, but I want to let you have your own copy to play with


I would share this link with you.

https://script.google.com/macros/s/AKfycbz3todkXzvm82x4JgaoffjYkJTleyA15vcLptfoRQ2Pa2KxntQ/exec?sourceid=0B92ExLh4POiZcnJtZ3R5TGFoa1k&target=BrucesCopyFolderProject

or more probably i'd use a URL shortener to make this https://goo.gl/ML4CUi

You'd see this



And hitting copy would make a new copy of each of these files on your Drive.

Go ahead and try if you want a copy of this script and document.


The code


Why not just get your copy delivered to your Drive with the webApp using https://goo.gl/ML4CUi
This blogpost gives some more info on setting up for your own folders.

Latest version

The link above and video represent V1 of this app. A new version is available at http://goo.gl/p3Ixbl and  on GitHub . Some more info on how that was built  can be found at Implementing a client side progress bar reporting on server side work for htmlService


For more like this, see Google Apps Scripts snippets. Why not join our forum, follow the blog or follow me on twitter to ensure you get updates when they are available.

You want to learn Google Apps Script?

Learning Apps Script, (and transitioning from VBA) are covered comprehensively in my my book, Going Gas - from VBA to Apps script, available All formats are available now from O'Reilly,Amazon and all good bookshops. You can also read a preview on O'Reilly

If you prefer Video style learning I also have two courses available. also published by O'Reilly.
Google Apps Script for Developers and Google Apps Script for Beginners.






Comments