Google Script Drop Box/Display Package

flickr photo shared by cogdogblog under a Creative Commons ( BY ) license

Because I still read the posts from the good people over at HCPS I came across Doug’s post on a script that Michael Price wrote. The script sets up a form that lets anyone upload a file to a Google Folder.1

It intrigued me so when one of our professors was asking about allowing students to upload raw video for other students to use, I figured I’d check this out as a solution.

You can/should get the basics from the video that’s in the post above.

I made a few alterations based on our particular needs. One, I wanted the folder to be viewable by anyone so they could get the files easily. I could have set the sharing permissions after the creation of the file by hand but . . . I didn’t want to.2 I also wanted to tighten up the connection between submission and being able to see all the results. It turns out you can’t currently iframe any of this without drama so I included a link to the folder after the submission and demo’d using the Google Folder WordPress plugin I made a while ago below.

The main work is done in the script below (all credit to Michael Price). I just added a few variables for my purposes but it does start to point at the sophistication of what one might do down the road.

function doGet(e) {
  return HtmlService.createHtmlOutputFromFile('form.html');        

function uploadFiles(form) {
  try {
    var dropbox = "pirateboxer";//names your folder
    var folder, folders = DriveApp.getFoldersByName(dropbox);
    if (folders.hasNext()) {
      folder =;
    } else {
      folder = DriveApp.createFolder(dropbox);
      folder.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.VIEW); //sets permissions on folder so anyone can view - delete this line if you want to set it manually
    var blob = form.myFile;    
    var file = folder.createFile(blob);    
    file.setDescription("Uploaded by " + form.myName); //pulls the name field from the form
    file.setName(form.myName + '-' + form.myDescription) //pulls the description field from the form
    return 'File uploaded successfully - click <a href="' + folder.getUrl()+'">here to view the files</a>.'; // this links to the folder created above
  } catch (error) {
    return error.toString();

Get a copy here.

Try it out here. See the results below or via the link on the form itself.

1 There’s also the potential to use it like a Google Driven Piratebox.

2 Computers should enable me to be lazier in the long run.