Sync your Airtable base with Google Sheets

Update a Google Sheet on a schedule using Google App Script and CSV Getter.
If you like article run throughs, keep reading. If you prefer videos, watch this:
Sync your Airtable base with Google Sheets
Once you have created your url, make sure you are using type=csv.
Response Sample
Field 1,title,budget,year,genre,length
64,Coach Carter,38.57889077,2005,Drama,136
281,Alien Abduction,0.771577815,2005,Other,90
Google sheets allows you to easily create automations in your Google Sheet using Google App Script. We are going to use it to create a function that will update your GSheet with your latest Airtable data. The great thing about this function is that it can be scheduled to run at an interval of your choosing.

Step 1

Open your Google sheet and click 'Extentions'

Step 2

Under Extensions, click App Script.
Step 3
In your file, paste the following code
function csvGetter() {
// URL of the CSV file (replace with yours)
var url = "";
// Fetch the CSV file
var response = UrlFetchApp.fetch(url);
// Get the contents of the file as a string
var csvString = response.getContentText();
// Convert the CSV string to a 2D array
var csvData = Utilities.parseCsv(csvString);
// Get the active sheet
var sheet = SpreadsheetApp.getActiveSheet();
// Clear the existing data in the sheet
// Write the data from the CSV file to the sheet
sheet.getRange(1, 1, csvData.length, csvData[0].length).setValues(csvData);
Step 4
Saving the file, you can now run the function called csvGetter. (You may need to give this script permission to access the sheet. I explain this in the video above.)
Step 5
Once you have run the function ... Congratulations!
- your gsheet will now be full of your Airtable data.
Now lets setup a schedule. Back in the Apps Script screen, click Triggers (the alarm clock icon)
Click Add Trigger
Under trigger settings, click 'Time Driven' - this allows you to customise how often the trigger is run.
These settings will mean that the google sheet will update every hour
Once you press save, your Trigger is live
. You can see its working by waiting for a 'Last Run' timestamp to appear.
And now your Google Sheet is updating automatically from Airtable! If you want to see how this you can be used to make a dashboard in Looker (Google Data Studio) which is free, I can make a tutorial like this. Let me know at [email protected]
To learn more about me and my business visit AMJ Consulting.