Skip to content

Instantly share code, notes, and snippets.

var $form = $('form#test-form'),
url = 'https://script.google.com/macros/s/abcdefghijklmnopqrstuvwxyz1234567890/exec'
$('#submit-form').on('click', function(e) {
e.preventDefault();
var jqxhr = $.ajax({
url: url,
method: "GET",
dataType: "json",
data: $form.serializeObject()
<form id="test-form">
<div>
<label>Field 1</label>
<input type="text" name="form_field_1" placeholder="Field 1"/>
</div>
<div>
<label>Field 2</label>
<input type="text" name="form_field_2" placeholder="Field 2"/>
// original from: http://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/
// original gist: https://gist.github.com/willpatera/ee41ae374d3c9839c2d6
function doGet(e){
return handleResponse(e);
}
// Enter sheet name where data is to be written below
var SHEET_NAME = "Sheet1";
@davidmccoy
davidmccoy / Google-Sheet-Form-Post.md
Created June 10, 2017 01:16 — forked from willpatera/Google-Sheet-Form-Post.md
Post to google spreadsheet from html form

Overview

This collection of files serves as a simple static demonstration of how to post to a google spreadsheet from an external html <form> following the example by Martin Hawksey

Run example

You should be able to just open index.html in your browser and test locally.

However if there are some permissions errors you can make a quick html server with python. Open terminal and cd to the directory where the gist files are located and enter python -m SimpleHTTPServer. By default this creates a local server at localhost:8000

@davidmccoy
davidmccoy / Contract Killer 3.md
Last active August 29, 2015 14:26
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

jQuery(document).ready(function() {
/*
Snippet from http://stackoverflow.com/a/5918791
*/
navigator.sayswho = (function(){
var N= navigator.appName, ua= navigator.userAgent, tem;
var M= ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
development: &defaults
adapter: postgresql
encoding: unicode
pool: 5
host: localhost
username: <%= `echo $USER`.chomp %>
password:
database: <%= File.basename(Rails.root) %>_development
test:
group :development, :test do
gem 'pry-rails'
gem 'rspec'
gem 'rspec-rails'
gem 'guard'
gem 'guard-rspec'
gem 'guard-bundler', require: false
gem 'terminal-notifier-guard'
gem 'shoulda-matchers'
gem 'capybara'

CONTEXT

WHAT USER STORY YOU ARE WORKING ON:

I am working on the user story "User wants to log in."

WHAT YOU ARE TRYING TO DO:

I am trying to have the user update their profile.

@davidmccoy
davidmccoy / html sinatra layout
Created March 21, 2014 14:04
html layout for sinatra
<html>
<head>
<title></title>
<meta charset="utf-8">
</head>
<body>
<%= yield %>
</body>
</html>