Skip to content

Instantly share code, notes, and snippets.

@abass
Created January 4, 2017 05:47
Show Gist options
  • Save abass/016b83cdf1efe89d8d610c2487509908 to your computer and use it in GitHub Desktop.
Save abass/016b83cdf1efe89d8d610c2487509908 to your computer and use it in GitHub Desktop.
We post directly to the google spreadsheet from a custom form and do not use google forms; the code snippet below is in python and posts to the google sheet which is then captured via google sheet's doPost(e) function:
form_fields = { "fname": firstName, "lname": lastName, "title": title, ... rest of form fields to go to spreadsheet}
url = "https://script.google.com/macros/s/[your spreadsheet key]/exec"
form_data = urllib.urlencode(form_fields, doseq=True)
result = urlfetch.fetch(url=url, payload=form_data, follow_redirects=True,method=urlfetch.POST,
headers={'Content-Type': 'application/x-www-form-urlencoded'})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment