Airtable is a powerful platform for hosting dynamic business data that is constantly changing. Exporting Airtable to Google Sheets is important for backing up your data and performing extra analysis. Google Sheets can be updated with Airtable data either manually, or automatically. Below are three ways to enable this process depending on your use-case.
This first method is the most straight forward, and manual way of getting Airtable data into Google sheets.
Open your Airtable base, and where it says the name of your view in the top Nav bar (in this case, Grid View), click the View Name to produce a dropdown.
Click Download CSV.
With your downloaded CSV, head over to Google Sheets and create a new spreadsheet.
Click File > Import.
Click the Upload tab of the pop up menu.
Decide if you would like to create a new sheet with your Airtable data or replace your current working one. In our case, we will replace our current sheet.
Press Import data.
And your Airtable data is in Google Sheets.
IMPORTDATA()
This is a semi-automatic method that, once you are setup, offers a quick and easy way of updating your Google Sheet with the latest Airtable data.
With this method, your data will update without needing to re-download your base from Airtable each time. Additionally, you can update your Airtable data import without leaving your active sheet.
This method, and the fully-automatic Method C will both require an Airtable Export URL. You can create an Airtable Export URL with CSV Getter or test this process with our demo URL available to copy and paste below.
https://api.csvgetter.com/AADVgE0BE2k04FgjZJtX
In a new Google Sheet, click on cell A1
and enter the following formula:
=IMPORTDATA("https://api.csvgetter.com/AADVgE0BE2k04FgjZJtX")
If you are not using the demo export URL, remember to replace the URL with the one you would like to use.
Press enter, and Airtable data will load to Google Sheets.
If you used the example URL, you have just synced your Google Sheet with this base.
A simple way of refreshing IMPORTDATA()
is to slightly change your URL string to re-run it. This can be done by adding a space at the end of the URL and pressing enter. Then, when you want to refresh again, remove the space and repeat the same process. You can refresh the data as many times as you want by adding and removing the space
With Google App Script and an export URL, you can export Airtable to Google Sheets automatically. To get setup follow the steps below.
Open a Google Sheet and click Extensions from the top tab. Under the Extensions drop down, click App Script.
You will then see the App script editor screen.
In your Code.gs file, paste the following code:
function csvGetter() {
// URL of the CSV file [REPLACE WITH YOURS]
var url = "https://api.csvgetter.com/AADVgE0BE2k04FgjZJtX";
// 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
sheet.clear();
// Write the data from the CSV file to the sheet
sheet.getRange(1, 1, csvData.length, csvData[0].length).setValues(csvData);
}
If you are using your own Export URL and not the test URL, remember to replace it
Save the Code.gs file. This will allow you to run the function called csvGetter
. (You may need to give this script permission to access the sheet.)
Once you have run the function your Google Sheet will now be full of your Airtable data.
You can use the Triggers menu to schedule when the script runs. A trigger is a method of running your code automatically. We can use the Triggers menu to create a time-driven trigger to automatically export Airtable to your Google Sheet.
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.
Press save, and your Trigger will be 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.
You can also stay notified when your export is completed successfully by adding the email_me to your CSVGetter URL.
Including the email_me parameter will show you exactly when the process was completed. The process can be labelled with the optional email_tag parameter so that you or your organisation can know that a backup process was completed at, say, 9 am and that the Airtable data was exported to your Google Sheet.
The email includes a copy of the Airtable export URL used. This can remind you to download your data locally, daily, to have a fully comprehensive backup solution.
Automatically export your Airtable data with CSV Getter