Home > Blockchain >  Scraping a website, Google Sheets IMPORTXML function, get specific lines in columns
Scraping a website, Google Sheets IMPORTXML function, get specific lines in columns

Time:10-06

I need to scrape the "Call date" and "Distribution dates" cells in the following link, and import the data into google sheets.

https://www.quantumonline.com/search.cfm?tickersymbol=acp-a&sopt=symbol

However, when I do it I get all the information in the specific cell. I am trying to just get the first line in the cell, but I have not been able to figure out how to do it. I have tried this:

=IMPORTXML("https://www.quantumonline.com/search.cfm?tickersymbol="&B2&"&sopt=symbol","//tr[@bgcolor='FFEFB5']/../tr[2]/td[6]")

For example when I use this I get the distribution dates in the sixth column but do not know how to to cut off the lines below that and just get the information on the first line. Same goes for the other columns.

CodePudding user response:

You can use text() and a predicate in square brackets to specify which text node you wish to select.

=IMPORTXML("https://www.quantumonline.com/search.cfm?tickersymbol=acp-a&sopt=symbol","//tr[@bgcolor='FFEFB5']/../tr[2]/td[6]/font/text()[1]")

  • Related