Web Scraping Co-Sponsors on NYS Bills using Google Sheets using IMPORTXML

Viewed 79

I am currently trying to write a formula in Google Sheets so that it will take the co-sponsors for a NYS and put them into my google sheet. The formula that I wrote is:

=IMPORTXML(https://nyassembly.gov/leg/?term=2021&bn=S01184, "//[@id='legcontent']/table/tbody/tr[7]/td[2]").

//*[@id='legcontent']/table/tbody/tr[7]/td[2] is the xPath for the data that I am trying to extract which I copied from the HTML on the website.

I am getting the error "Formula Parsing Error", however, I do not see where the error is. It would be much appreciated if anyone could help out!

1 Answers

use:

=INDEX(IMPORTHTML("https://nyassembly.gov/leg/?term=2021&bn=S01184", 
 "table", 1), 7, 2)

enter image description here

Related