Makeinfo Blog

Makeinfo Blog

How to submit Airtable Form with Puppeteer

How to submit Airtable Form with Puppeteer

Learn how to submit your Airtable form automatically using Puppeteer

Dorothi Viki's photo
Dorothi Viki
·Jun 14, 2021·

3 min read

This is a simple Nodejs script sample that will show how you can programmatically submit Airtable Form automatically using Puppeteer(a Node library to control Chromium-based browser). In this tutorial, I will talk about Puppeteer and Airtable prefill methods to auto-submit forms.

airtable-auto-submit.gif

I am assuming you have at least some knowledge in running the Nodejs script. You can use the same method to submit any Airtable data from other data sources (Google Sheet), the only thing you need to consider is to create it as a JSON array. If you are looking for advanced usage, please consider using Airtable API.

Personal Experience

I created this script and a Chrome extension (which I will talk about later) for my client when I saw they used to enter so many similar details from websites more than 100 times a day. I would like to let you know that there are some issues when submitting multiple forms simultaneously. If you are looking for prefilling and auto-submitting for so many pages, I would suggest reading this thread.

Requirements

  • Your Airtable Form
  • Node.js on your computer ( How to setup Nodejs )
  • A Good IDE (mine is VS Code)
  • Data in JSON format
  • Little JS knowledge (even on How to run Nodejs script would be helpful)

What is Puppeteer?

Puppeteer is a Nodejs library use to control headless Chromium browsers. In layman's terms, you can use this library to do things like making screenshots, browser actions, and many more without opening Chrome. If it doesn't ring a bell, then watch this useful video from Google and read this article.

Setup project

  1. Create a folder (pick your name)
  2. Open that folder in VS Code
  3. From VS Code terminal, npm init
  4. Now, install Puppeteer, using npm install puppeteer
  5. Create index.js
  6. Copy & paste our code below
  7. Make necessary changes

Code: index.js

Make necessary changes

1) Replace Airtable URL by updating the URL on baseURL from the script.

2) Add prefill variable using prefill_"Variable from Airtable Form". Please note %20 is for space. You don't need it if there is not space. From the below Form image you can see that prefill_Company%20Name, prefill_Company%20Domain is an example.

Screen Shot 2021-06-14 at 1.44.55 PM.png

3) That's it, run the code by node index.js

Useful Resources

CSV/Excel to JSON

If your data source is a CSV file, then it's better to use something like online converter.

Google Sheet to JSON

If you have the details on Google sheet and want to convert them into JSON, please check this article or use SheetDB (This is a Makeinfo affiliated product). Please make the decision based on your requirements, if you just need to convert the sheet to JSON.

Conclusion

Finally, you got the working Nodejs script to automatically submit the Airtable form based on your data. I hope this is helpful for you. If you stuck somewhere or need some help, please use the comment section below.

 
Share this