The Google Fusion Tables API v1 has been deprecated as of May 3rd, 2016. The API will continue to work until August 1st, 2017, and will shut down on that date. A migration guide is available outlining the steps to take to migrate to v2.

Google Fusion Tables API Sample Code

Google Apps Script Example

The following example demonstrates how to run the SHOW TABLES query in Google Spreadsheets using a Google Apps Script.

function getGAauthenticationToken(email, password) {
  password = encodeURIComponent(password);
  var response = UrlFetchApp.fetch("https://www.google.com/accounts/ClientLogin", {
      method: "post",
      payload: "accountType=GOOGLE&Email=" + email + "&Passwd=" + password + "&service=fusiontables&Source=testing"
  });
  var responseStr = response.getContentText();
  responseStr = responseStr.slice(responseStr.search("Auth=") + 5, responseStr.length);
  responseStr = responseStr.replace(/\n/g, "");
  return responseStr;
}

function getdata(authToken, developerKey) {
  query = encodeURIComponent("SHOW TABLES");
  var URL = "https://www.googleapis.com/fusiontables/v1/query?key=" + developerKey + "&sql=" + query;
  var response = UrlFetchApp.fetch(URL, {
     method: "get",
     headers: {
          "Authorization": "GoogleLogin auth=" + authToken,
     }
  });
  return response.getContentText();
}