Google Apps Script Uploaders


Google Apps Script Uploaders


Google Sites Service

Using the Google 'Sites Service' you can create a User Interface to upload files. You need to create a 'File Cabinet' Page Template [This not a List Page!]

This allows a list of file uploads , links and sub-folders to be created using Google Apps Script code like this:

 page.addHostedAttachment(Blob);

where the page variable is the 

SitesApp.getPageByUrl('https://sites.google.com/...sites url here');

and the Blob variable is a Defined Mime using the Utilities Service for testing. A handler or function parameter is used to initialize the upload automatically , without needing a upload button.

Utilities.newBlob("Here is some data", "application/pdf", "FileUpload.pdf");

Creating a simple Cloud System - Google Sites Uploader with a UI, a few Publishing configurations and security tweaks.


Google Drive Service


You can set the MIME type with Google Apps Script Utilities Service for the file so it can be recognized by the Google Drive system.

For example you could upload HTML file and Host it now on Google Drive in a Public Folder, the HTML will render as a normal HTML webpage. 

You could use these HTML file for HTML template such as HTML Email Templates or advanced Google Apps Script User Interfaces eg. jQuery UI.

In Google Drive system for Uploading you set the folder location and create the Blob from a similar source and identical UI with uploads on selection. 

The Google Drive folder variable:

DocsList.getFolder("CloudSystemExamples/FileUploader/");

Create the File in the Google Drive Folder

folder.createFile(Blob);




[There are some issue with MIME type , sometime it maybe best not to set any MIME type, but there may not be a preview in Google Drive]

From the WYSIWYG Insert Menu > Folder , you can embed a Google drive folder on Google Sites.

Possible Upload Systems

Multiple Files Selection ?
Google Picker ?
Html Templates  -  HTML Email Templates ?
Sites HTML - Page Tempates

Google Apps Script Uploaders






FileUploader Folder for Google Drive Uploader