Skip to content

Instantly share code, notes, and snippets.

@mikeymckay
Created January 2, 2014 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeymckay/8224041 to your computer and use it in GitHub Desktop.
Save mikeymckay/8224041 to your computer and use it in GitHub Desktop.
Ruby script to post to any google form (no login required).
#!/usr/bin/env ruby
# usage:
# post.rb <live_form_url> arg1 arg2 arg3 ...
require "rest-client"
live_form_url = ARGV.shift
post_form_url = live_form_url.gsub(/viewform/,"formResponse")
params = RestClient.get(live_form_url).scan(/(entry\.\d+)/).flatten
options = {}
params.each do |param|
options[param] = ARGV.shift
end
RestClient.post post_form_url, options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment