Retrieve node property values
The =DCPROPERTY
formula returns values associated with the given property for a single place DCID or list of places.
Formula
=DCPROPERTY(dcids, property)
Required arguments
dcids
: A single place node or range of cells representing nodes, identified by their DCIDs.property
: The label of the property whose value you are interested in, such asname
for the name of a node, ortypeOf
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 Knowledge Graph to look up the DCID of interest and see what properties it is associated with.
Returns
The values of the property label for the specified DCIDs.
Examples
This section contains examples of using the =DCPROPERTY
to return values associated with the given property.
Note: Be sure to follow the instructions for for enabling the Sheets add-on before trying these examples.
Example 1: Retrieve the common name of a country by its DCID
To retrieve the name of a country by its DCID:
- Place your cursor in the cell where you want to add a DCID; in this case, cell A1.
- Enter
country/CIV
for the country Ivory Coast. - Place your cursor in cell B2 and enter
=DCPROPERTY(A1, "name")
to retrieve the Ivory Coast country names in column B; note that the French and English spellings for Ivory Coast appear in column B.
Example 2: Retrieve the order to which a plant belongs
To retrieve the order to which the plant Austrobaileya Scandens belongs:
- Place your cursor in the cell where you want to add a DCID; in this case, cell A1.
- Enter
dc/bsmvthtq89217
for the plant Austrobaileya Scandens. - Place your cursor in cell B2 and enter
=DCPROPERTY(A1, "order")
.Austrobaileyales
appears in cell B2.
Example 3: Retrieve the addresses of two high schools
To retrieve the addresses of Stuyvesant High School in New York and Gunn High School in California:
- Place your cursor in cell A1 and enter
nces/360007702877
for Stuyvesant Hight School in New York. - Place your cursor in cell A2 and enter
nces/062961004587
for Gunn High School in California. - Place your cursor in cell B2, and enter the formula
=DCPROPERTY(A1:A2, "address")
. The addresses of both high schools are populated in column B.
Error responses
If you pass a nonexistent property, an empty value is returned. For example, because the “nonexistent property” does not exist, no value is returned to cell B1 in the following sheet:
If you pass a bad DCID, an empty value is returned:
If you pass an empty DCID, a response of #ERROR!
is returned:
If you do not pass a required property argument, a response of #ERROR!
is returned:
Page last updated: November 21, 2024 • Send feedback about this page