Friday, April 29, 2016

How to write to Google Sheet from an iOS app - Part 2

In the previous post we saw how we could setup the Google Form to write to Google Sheet.

We will need 2 additional steps to submit information to Google Form from iOS app.

  • Extract the various identifiers (like URL, field id etc) of Google Form
  • Use the identifiers in the iOS app to do an HTTP POST to Google Form
In this post we will focus on the first step only.


Extract Identifiers From Google Form

  • All we need to do is click on the "Preview" button on our google form page.


  • It should open up our form as below


  • Right click on the form and say "Inspect".


  • If you are using Chrome brows, it should open up a panel below the page which looks something like this


  • Find a tag called "<form>" in the panel, there you should look for "action" attribute.  This attribute has a big URL as its value.  Save this URL we will to POST to this URL from our iOS app.


  • Next, Right click on the input field in your form and click "Inspect".  It should show "input" tag highlighted in the panel below.


  • We are not really interested in the input tag that the panel is showing, 
  • We need to find another input tag which is of 'type="hidden"'.  This input tag would be 8-9 lines below the input tag currently highlighted


  • Note down the value of "name" attribute on the input.  Do the same thing for other fields in the Google Form.  These keys will be used when we submit information from our iOS app to this form.

Once we have these identifiers noted we are left with one last step i.e. to do the HTTP POST from iOS app to Google Forms.  We will see how to do that in the next post.
Have some Fun!