0

I'm trying to get the US Population from this webpage: Link

Here it is in the HTML:

<div id="us-pop-container">
<h3>U.S. Population</h3>
<!-- population counter -->
<p>316,434,526</p>
</div>

What I want is the 316,434,526, which is the population. (but it changes)

Here is the xpath:

//*[@id="us-pop-container"]/p

When I put it into Google Docs, it returns nothing. However, if I put:

//*[@id="us-pop-container"]

it returns the comment, "population counter". How do I return the population number?


Here is my full spreadsheet:

A1:

http://www.census.gov/popclock/print.php?component=counter

A2:

//*[@id="us-pop-container"]

A3:

=ImportXML(A1,A2)
4

1 回答 1

0

你也可以试试这个:

=REGEXEXTRACT(CONCATENATE(IMPORTDATA("http://www.census.gov/popclock/data/population.php/us")),"population:(.*)population_rate")
于 2016-01-01T18:51:42.523 回答