Data Commons Sheets API
The Data Commons Sheets API is a Google Sheets add-on that enables Google Sheets users to import data from the Data Commons knowledge graph. The add-on provides an interface for finding a location’s DCID, as well as some custom functions for importing data to a spreadsheet.
Install the add-on from G Suite Marketplace. To enable the add-on in a document, click “Add-ons > Data Commons > Fill place dcids”. You may use the resulting sidebar to start finding dcids in the United States, or close it and reopen it at any time. Note that none of the custom functions will work in a given document until you have enabled the add-on by choosing “Fill place dcids”.
Finding a place’s DCID
Data Commons’ Sheets add-on ships with the ability to look up a location’s DCID, or unique Data Commons identifier, within the application. To use this feature, select the final destination cell of the place DCID. Go to the Sheets menu bar, and click:
“Add-ons > Data Commons > Fill place dcids”
A sidebar will appear on the right of the sheet, with a search bar where you can start typing the name of the place you want. From the drop down menu, select the place you want, and its DCID will appear in the cell that you selected.
Note that this feature only supports places in the United States.
Sorting your results
To sort columns of data from the API, we suggest using the "filter views" Google Sheet feature.
Please check the following video for a complete example:
To summarize, the steps are:
- Populate data columns with DataCommons Sheets API
- Turn on filter views (Data > Filter views).
- Click the reverse triangle on each column to sort by that column (and exclude header row).