javascriptgoogle-apps-script

using google form to capture pictures/images from cell phone


I am trying to create a audit form, so when an auditor comes across an issue, they can have the option to take picture, and when form is submitted the pictures will be uploaded to spreadsheet as well. I will be using this as a mobile platform... I have searched but not sure if this is entirely possible. I do not need to use Gforms but would like to use the same concept as when form is submitted it goes into database spreadsheet. thanks in advance


Solution

  • Create a fileUpload interface:

    https://developers.google.com/apps-script/reference/ui/file-upload

    Create a Blob from the fileUpload:

    https://developers.google.com/apps-script/reference/base/blob

    Finally, use Interfaces > BlobSource 'getAs(contentType)' method to insert the blob as an image into your Google Spreadsheet.

    https://developers.google.com/apps-script/reference/base/blob-source

    ///EDIT for comment below///

    fileUpload is essentially the html 'input type='file'' which is currently supported by the mobile browsers listed in this article:

    http://viljamis.com/blog/2012/file-upload-support-on-mobile/

    By creating the fileUpload interface in your web app form your user would be given the option to select a file from their mobile device, if supported.

    Example code here:

    https://sites.google.com/site/appsscripttutorial/user-interface/upload-doc