Reputation: 43
I need to scrape the "Cpn Rate Ann Amt" cell from this website LINK.
I have tried this:
=IMPORTXML("https://www.quantumonline.com/search.cfm?tickersymbol=BAC-P&sopt=symbol","/html/body/font/table/tbody/tr/td[2]/p[1]/table[2]/tbody/tr[2]/td[2]/font")
as suggested by literally every tutorial I saw online, but I just couldn't get it to work. Maybe it just doesn't work since the website has .cfm pages.
Upvotes: 1
Views: 266
Reputation: 201348
I believe your goal as follows.
I need to scrape the "Cpn Rate Ann Amt" cell from this website LINK.
, you want to retrieve the value of the header of Cpn Rate Ann Amt
using IMPORTXML.In this case, how about the following sample formula and xpath? When I saw the HTML in the URL, I thought that the background color of <tr bgcolor="FFEFB5">
is only the table, and this might be able to be used as the xpath.
=IMPORTXML(A1,"//tr[@bgcolor='FFEFB5']/../tr[2]/td[2]")
https://www.quantumonline.com/search.cfm?tickersymbol=BAC-P&sopt=symbol
.When you want to the value of Cpn Rate Ann Amt
, you can also use the following formula.
=IMPORTXML(A1,"//tr[@bgcolor='FFEFB5']/th[2]")
In this sample formula and xpath are for the URL of https://www.quantumonline.com/search.cfm?tickersymbol=BAC-P&sopt=symbol
. So when the URL is changed, the xpath might not work. So please be careful this.
Upvotes: 1