Google Data Studio connector for Airtable

You could use Railsware’s Airtable Importer to get your data into a Google Sheet:

https://railsware.com/case-studies/airtable-importer/

Then just use the Google Sheet as a source for Data Studio.

2 Likes

Thanks Matt, that importer is awesome! I’m having trouble refreshing data with the Railsware add-on though, given the volume of tables syncing to different spreadsheet tabs. Appreciate your suggestion :slight_smile:

I tried this but if you use more than one table is has been problematic for me. As I recall, linked fields show as reference IDs instead if the linked values. Seems like I had a few cases were the IDs translated to the linked value. Perhaps its a look up field that translates while table links do not.

This would be a great integration! i am curious how your private connector works and how yo did it.

1 Like

How it works: the connector queries the Airtable API regularly, one table at a time, to keep it up to date.

How I did it: searched through this forum for various code snippets, and hacked them together until I got something working. Happy to share the results if it’s helpful.

1 Like

Sounds like that would be more helpful.

It will be very usefull feature !

Here’s the function for querying the Airtable API. Instead of using the function name below, you’d call this getData() as mentioned on https://developers.google.com/datastudio/connector/build

function fetchDataFromAirtable(tableName, viewID) {
  
  // Initialize the offset.
  var offset = 0;

  // Initialize the result set.		
  var records = [];

  // Make calls to Airtable, until all of the data has been retrieved...
  while (offset !== null){	

    // Specify the URL to call.
    var url = [
      "https://api.airtable.com/v0/", 
      baseID, 
      "/",
      encodeURIComponent(tableName),
      "?",
      "api_key=", 
      api_key,
      "&view=",
      viewID,
      "&offset=",
      offset
      ].join('');
    var options =
        {
          "method"  : "GET"
        };
    
    //call the URL and add results to to our result set
    response = JSON.parse(UrlFetchApp.fetch(url,options));
    records.push.apply(records, response.records);
    
    //wait for a bit so we don't get rate limited by Airtable
    Utilities.sleep(201);

    // Adjust the offset.
	// Airtable returns NULL when the final batch of records has been returned.
    if (response.offset){
      offset = response.offset;
    } else {
      offset = null;
    }
      
  }
  return records;
}
1 Like

Excellent. Thank you.

Hi Optimi
Thanks for this great contribution. But how can I use it as connector in DataStudio? I have to create it then publish it? How?
Sorry for this noob question.
Laurent

Pleasure, hope it’s useful! Pretty sure you can write the code as a Google Apps Script project, and then start using it in data studio without having to publish anything. This page explains a little more: https://developers.google.com/datastudio/connector/use

Thanks.
But unfortunately, still getting an error message, as this connector is not autorised.

Oh no! I’ll look into this if I get time - and if you figure out the solution please post it here :slight_smile:

Folks, we’ve published a recipe on how to connect Airtable to Google Data Studio, using Google Sheets as an intermediary:

cc @Laurent_Tourneux @Ron_Majors You might find this easier than making your own Data Studio connector :slight_smile:

3 Likes

So amazing! Much gratitude on this one.

Same problem here… =(

This feature request is essential. +1

Hey Rupert, thanks for putting this here. I’m trying to get this whole thing as a connector running. do you have the code for the other functions (config, schema) etc. available as well?

Best

What is the CURRENT, BEST WAY to sync data REAL TIME, AUTOMATICALLY from AT to Data Studio. These forums are always super dated and incomplete and cobbled together. Would be nice to NOT have to parse through all the out-dated methods if there are NEW ways to do things. Are we still farting around setting up a sync to Sheets or is there a better mousetrap?? Please advise most recent methods. Thanks. :slight_smile:

3 Likes

Hi everyone. I had this problem too. But I searched for some add-on to connect Airtable to Google Sheets, and I found that one: https://gsuite.google.com/u/0/marketplace/app/couplerio/532272210531?hl=pt&pann=sheets_addon_widget

It allowed me to connect many bases (even from different workplaces) in a single Google Sheet that can be used at Data Studio.

The most funny part is that this add-on refresh all the data automatically and replace the information, instead to create a new row.

Some images:

Another point: it’s for free, but it has limits.

image

You can create 1000 imports per month and 50.000 rows per month. Every month, it resets.

But, to be honest, it’s a lot of imports and rows per month.

I hope it helps you, guys!