Google Data Studio connector for Airtable


#1

Hey Airtable team, have you come across Google Data Studio? It’s a free tool that is excellent for visualising data and creating BI dashboards - a perfect companion to Airtable.

Google Data Studio has ‘community connectors’ that allow users to pipe in data from third party services such as yourselves. I’m trying my hand at building a private connector for one of my bases at the moment, and it’s not too tricky.

So, my request is for you folks to build a public ‘community connector’ that anyone could use to connect their Airtable data to Google Data Studio! More info here: https://developers.google.com/datastudio/connector/developer-launch/


#2

Could also be an easy solution to this request: Ability to create graphs, charts, maps from data in Airtable database


#3

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.


#4

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:


#5

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.


#6

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


#7

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.


#8

Sounds like that would be more helpful.


#9

It will be very usefull feature !


#10

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;
}

#11

Excellent. Thank you.