Retrieve property values for nodes

Given a list of nodes and a property label, returns values associated with the given property for each node.

General information about this formula

Formula: =DCPROPERTY(dcids, property)

Required arguments:

  • dcids: A list of nodes to query, identified by their Data Commons identifiers.
  • property: The property to query for.

Returns

The value of the property label for the specified DCIDs.

Assembling the information you will need to use this formula

Going into more detail on how to assemble the values for the required arguments:

  • dcids: Data Commons uniquely identifies nodes by assigning them DCIDs, or Data Commons IDs. Your query will need to specify the DCIDs for the nodes of interest. More information about DCIDs is available in the glossary.

  • property: The property whose value you are interested in, such as “name” for the name of a node, or “typeOf” for the type of a node. If you aren’t sure what properties are available for a particular DCID, you can use the Data Commons graph browser to look up the DCID of interest and see what properties it is associated with.

NOTE:

It’s best to minimize the number of function calls to DCPROPERTY by using a single call to get a variable for a row/column of places and/or a column/row of times. This is because a spreadsheet will make one call to a Google server per custom function call. If your sheet contains thousands of separate calls to DCPROPERTY, expect it to be slow.

Example requests and responses

Before trying this method out, make sure to follow the setup directions in the main section for Sheets docs.

Example 1: Retrieve the common names of a country by its DCID.

Example 2: Retrieve the order to which the plant Austrobaileya scandens belongs.

Example 3: Retrieve the addresses of Stuyvesant High School in New York and Gunn High School in California.

Error Returns

If you pass a nonexistent property, an empty value is returned:

If you pass a bad DCID, an empty value is returned:

If you pass an empty DCID, an error is returned:

If you do not pass a required positional argument, an error is returned: