Using Curl to add rows to a Google Spreadsheet without using an API

Adding content to a Google Spreadsheet usually requires using the Spreadsheet API (, getting auth tokens, and tearing out 42 pieces of hair or more. If you just want to use Google Spreadsheets to log some information for you (append-only), a simple solution is to use a Google Form ( to submit the data. To do that, you just need to POST data using the field names, and you’re done. The data is stored in your spreadsheet, you even get a timestamp for free.

1. Create a Google Form with just a text question

You can use multiple text fields, we’ll just keep it easy for now.

2. Scrape the field IDs

You’ll need the IDs used for the fields. They can change from form to form. Just click “View live form”, you’ll now see the normal form as someone filling it out would see it. Use “Inspect Element” (or your favorite browser feature to see the HTML; in Chrome it’s with right-click, Inspect Element) and look at the HTML in the form.

What you’re looking for is something like the id="entry_312992878" in this screenshot.

3. Craft your Curl command-line

Curl is just a simple command-line tool to grab web-pages. We’re just going to POST data, not actually look at what comes back. It doesn’t take much.

First, get the form response URL. Take the URL shown with “View live form” (something like in my example), drop the “viewform” and replace it with “formResponse”. In this case, we’ll end up with This is the URL where we send the data.

With that, the command line is pretty basic (this is all on one line):

curl \
  '' \
   --data 'entry.312992878=test'  

Double-check the responses for your form, you should have your test-responses there now.

4. Done!

To make it a bit less messy, you can hide the output in the command-line, and just post your updates silently:

curl '' --data 'entry.312992878=test' --silent >/dev/null

If you have multiple columns (text fields in the form), just separate them with an ampersand (&). For example:

curl \
  '' \
  --data 'entry.312992878=test&entry_1474587160=test2' --silent >/dev/null

POST away!

Comments / questions

There's currently no commenting functionality here. If you'd like to comment, please use Twitter and @me there. Thanks!

Tweet about this - and/or - search for latest comments / top comments

Related pages