# Submitting a Google Form using the Command Line

I use Google Forms ALOT! On a normal day, I’m looking at 10 — 15 submissions to the same two forms: a personal expense tracking form, and a company expense tracking form.

The traditional process of opening the browser, typing in the URL, manually filling in the different fields and hitting Submit was getting incredibly annoying. I wanted a way to be able to submit a form in seconds, and without leaving whatever it was I was working on.

I needed a way to submit a form using the command line!

## The Steps

Turns out, it’s actually pretty simple to do!

1. Head over to your form URL and click on the “Edit” icon in the top-right:
2. Click on the ⋮ in the top-right, and select “Get pre-filled link”:
3. Fill the form, and click “Get link”:
4. You should now have a link that looks something like this:
 https://docs.google.com/forms/d/e/1FAicQLSe-Tdl1aEjHkKdsS0oQ0g-jfIqvQaAGT0enZoyIXlYh4UjKHg/viewform?usp=pp_url&entry.1491423912=Shopping&entry.1092687747=100&entry.478624260=1kg+of+frog+legs


Now, we just need to make 2 changes (not needed if you’re using my fancy tool below):

• Replace viewform with formResponse, and
• Append &submit=Submit to the end of the URL

That’s it! You can paste that link into your browser, and you should see the familiar “Your response has been recorded” message.

## An even easier way…

Of course, to actually use this in the command line, we need to use curl.

To make things easy for you, I created a neat little tool for this. Just paste your pre-filled link from above, and it’ll generate the curl command for you!

## The Tool 🛠

and… hey presto ✨

Your curl command is:

## What I do

I then take the curl command above and add it to my .bash_profile like so:

# ~/.bash_profile
aed () {
local amount=$1 shift local category=$1
shift
local description="$*" curl -G -Ss \ --data-urlencode "entry.1491423912=$category" \
--data-urlencode "entry.1092687747=$amount" \ --data-urlencode "entry.478624260=$description" \

aed 10 shopping 1kg of frog legs