Google Pre-filled Forms

A good solution for forms on a static websites is Google Forms. I have discussed how Google Pre-filled form link works here.

Google forms is a great product from Google which has solved a major problem web had - collecting user-submitted data.

Google forms not only solves that, but also provides a way to get the data as a spreadsheet which in turn can be used to generate graphs and other visual aids for analysis.

I have already written about it in one of my blogs on how to use it in a website without embedding it. In that way, you can use your input fields, buttons, and so on and on submission, the form is submitted to Google form.

This is a nice idea but you might get a lot of spam since you are kind of bypassing the Google form page altogether.

Why use Google Forms

  • It is free.
  • It handles spam.
  • It generates a spreadsheet with form entries in it.
  • Easy to generate graphs and other visual aids.
  • It is free(did I mention that already?).

Pre-filled Form Link

The method I’m discussing here is using Google Form pre-filled link which looks like this.


If you observe the link carefully, you see that the entries are in the link with spaces replaced with +s.


How to get the pre-filed link

In a google form edit page, you can click on the three dots and click on the Get pre-filed link.

You just redirect users to this link where they see the form all filled up(if you pass values with it)

How to pass values

This is easy using vanilla JS but becomes a cakewalk using Svelte.

  let name = "";
  let email = "";
  let message = "";

  $: prefilledLink = `${name}&entry.1454621435=${email}&entry.827655478=${message}&submit=Submit`;

  <input type="name" placeholder="Ashok Patel" bind:value="{name}" />
  <input type="email" placeholder="" bind:value="{email}" />
  <textarea placeholder="Hi, I'm..." bind:value="{message}" />
<a href="{prefilledLink}" target="_blank"><button>Submit</button></a>

This is it. I don’t think you can do this with this ease in any other JS framework(yet).

Here is a REPL

You can see it in action here Sveltekit Google Form

Here is an updated version of it where it can be used with Sveltekit and with auto-submission!

I hope this helped. Let me know if you were able to figure this out.

Let's discuss on Twitter