using google form to capture pictures/images from cell phone

11,522

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

Share:
11,522
INOH
Author by

INOH

Updated on June 13, 2022

Comments

  • INOH
    INOH almost 2 years

    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

  • INOH
    INOH over 10 years
    how do I call my camera from my phone
  • INOH
    INOH over 10 years
    I am a bit lost, when I create a fileupload interface, is this mean I am creating a new form and if so how do I create the new form, sorry about the newbiew questions but I am a bit out of my element but trying to learn.
  • Sam Scholefield
    Sam Scholefield over 10 years
    I would recommend having all of your widgets to record the submitted information (including the image fileUpload) in one form. Unless the amount of information your auditor is submitting is particularly epic a one page formPanel should be fine for your needs.
  • INOH
    INOH over 10 years
    thanks very helpful info, just where do I add the script to, I have been using google forms as of now
  • Sam Scholefield
    Sam Scholefield over 10 years
  • INOH
    INOH over 10 years
    I still confused, where do I place the code, may sound stupid but I must be missing something, am I still using a google form or do I have to create another form
  • Sam Scholefield
    Sam Scholefield over 10 years
    OK, this is outside the scope of the original question so you'll need to do additional research. Essentially you need to build your own form inside an application. My personal simple, short answer: I use UiApp.createApplication;() (to create an application instance) inside a doGet(e) function in a script embedded in a Google site. The doGet(e) function runs automatically when the user loads the page. I am fairly new to this myself and I hope my information has helped you. I realise it's probably created far more questions than it answered, but I find that is often the way when learning!
  • INOH
    INOH over 10 years
    No you helped me out a great deal, I have now got a good idea to run with, thanks for your knowledge and patience - enjoy the holiday seasons
  • Sam Scholefield
    Sam Scholefield over 10 years
    If it's for commercial usage then you may consider a 3rd party paid solution: jotform.com/blog/62-Send-Your-Form-Uploads-to-Google-Drive or a free plug-in that may or may not meet your requirements: formpl.us