Google Fusion Tables API

Sample code

An easy way to learn how to use an API is to look at sample code. The samples on this page demonstrate particularly interesting functionality in the Fusion Tables API or a variety of ways to access Fusion Table data.

Code samples

Fusion Tables API V1.0

A quick way to try out the API V1.0 is to type the command or query directly into your browser's toolbar. You can adjust the URL as you change your query or data needs and you'll get immediate feedback. See Getting Started. You can only do this with tables that are exportable and either public or unlisted, and you need to include your API key.

  • Lists all columns in a given table ( try this):{your API key}
  • Runs a query to select all rows in a given table (try this): * FROM 1KxVV0wQXhxhMScSDuqr-0Ebf0YEt4m4xzVplKd4&key={your API key}
Function Description Language/API

Uses the API V1.0 to authenticate with OAuth and to manage styles and templates.

Hello, python

  • OAuth 2.0 authentication
  • Get, insert, update, delete styles
  • Get, insert, update, delete templates
Python, API V1.0

Uses dropdown menu selections of styles and templates to change a map display dynamically.

Styles and templates

  • Uses styleid and templateid
  • Uses dropdown menu to change
API V1.0

Uses mouseover events to dynamically change the style of a polygon region.

Mouseover map styles

  • Mouseover events
  • Uses JSONP callback
API V1.0

A simple JSONP callback implementation that lists all the data in a table.

Basic JSONP example

  • Simple list of table data
  • Uses JSONP callback
API V1.0

Chart Tools API

Using the Google Chart Tools API, you can request data from Fusion Tables to use in visualizations or to display directly in an HTML page. Note: responses are limited to 500 rows of data.

As a shortcut, you can use the Fusion Tables Chart Wizard to generate the code necessary to create charts from your Fusion Tables data.

Function Description (table) Language

Creates dynamic data tables with dropdown menu choices.


Creates bar charts


Docs List API

With the Google Documents List API, you can set table permissions and move tables into or out of a folder. For more information, see the Docs List API documentation.

Function Description Language

Updates table permissions and do folder management.

Docs List API example

Key points:

  • Lists tables
  • Sets permissions on tables
  • Moves a table to a folder
Sets secure permissions for different collaborators of a view.

Collaborative data gathering

Key points:

  • Creates a view
  • Sets permissions for the view

Google Apps Script

These samples demonstrate the use of Google Apps Script to access Fusion Tables. Google Apps Script is a Javascript cloud-scripting language that provides easy ways to automate tasks across Google products and third party services

Function Description Language
Uses Javascript-like Apps Script to list tables

Google Apps Script

Key points:

  • Uses client login
  • Uses SHOW TABLES to list all the tables you own.
Google Apps Script
Sync Google Forms input with your table

Using forms with Fusion Tables

Note: This script uses the deprecated SQL API. Please use the migration guide to modify your script to use the v1 API.

Key points:

  • Uses a simple script
  • Allows form input
  • Syncs data with table automatically
Google Apps Script

Maps API: FusionTablesLayer - basic samples

Using the Maps API FusionTablesLayer object, you can style polygons, lines, and map icons on a Google Map. As a shortcut, you can use the FusionTablesLayer Wizard to generate the code necessary to create one or more Fusion Table layers.

Note: These code samples use the Google Maps API and are therefore subject to the same usage limits and TOS as any other use of the Maps API. For details, see the Google Geo Developers blog.

Some code samples assume the use of our style sheet. Make sure you include it in your own versions of these samples.

Function Description (table) Language
Introduces the FusionTableLayer object. JavaScript

Allows users to choose which pizza stores to display:

  • using a dropdown menu
  • using checkboxes
  • using autocomplete text in a search box

Maps API: FusionTablesLayer - finding, styling, customizing

Function Description (table) Language
Spatial queries: Finds map features within a defined area. See Working with geographic data. JavaScript
Customizes styles in a map layer, even include different legend boxes. JavaScript
Customizes info window templates JavaScript

Maps API: FusionTablesLayer - advanced sample code

Function Description (table) Language

Displays chart + map:

  • Uses two visualizations
  • Pans and zooms to locations

Uses different APIS and many map attributes:

  • FusionTablesLayer objects
  • Chart Tools API
  • multiple dropdown menus
  • dynamic styles
  • dynamic charts
  • dynamic legend
  • custom info windows
  • data from three merged data tables combined
  • Advanced sample code ( electricity consumption by county) -- Uses a 3-way merge table to display a complex chart plus dynamic styles and legends.

    As users change dropdown selections or click on counties, the map and chart elements change. The info window contents vary for different data values.

Tools and interfaces from Fusion Tables developers

Several Fusion Tables developers have created useful tools and interfaces for use with Fusion Tables.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.