Can you help me getting xpath for me for following URL
https://www.skyscanner.com.au/routes/SYD/MEL?currency=AUD
As you can see on this page, there are three tabs This month, Next Month and This Year. There are three prices in all three tabs. I need xpath for all nine prices and also html link for those 9 prices.
I have tried this below Xpath
//div[#class='FlightCard_FlightCard__priceContent__K59VJ']/div[#class='FlightCard_FlightCard__priceButton__BSPoZ']/div[#class='FlightCard_FlightCard__fromPrice__3M32b']/span[#class='BpkText_bpk-text__1H2sR BpkText_bpk-text--lg__1HjEY FlightCard_FlightCard__price__6ZsOs']
is giving me $126, $131 and $132 from the This month tab. I am not able to find three prices from Next Month and This Year tabs.
Thanks
You can use the below xpath to get the json which holds the url and the prices.
//section[#class='main-section flight-highlights']/div[#class='main']/script[1]
parse the json to get the required outputs using your preferred language and library.
Screenshot:
Related
For 1 Month low: I tried this Code in Google Sheet does not working
enter code here
=MIN(INDEX(GOOGLEFINANCE("NYSE:UBER","price",DATE(MONTH(TODAY()-30,MONTH(TODAY()),DAY(TODAY())), TODAY()),0,2))
Does not returning any value
When entered into Google sheets your formula comes up with the following error message:
"Wrong number of arguments to DATE. Expected 3 arguments, but received 2 arguments."
Looking at the formula there are a number of issues -
The date function is being fed three elements, but they do not make up a correct date. The function is being fed the month value twice instead of a year, month, day value.
So
=DATE(MONTH(TODAY()-30,MONTH(TODAY()),DAY(TODAY()))
should be
=DATE(year(TODAY()),MONTH(TODAY()-30),DAY(TODAY()))
In your original formula there is also a ) bracket missing as part of the year element of the date formula, so the formula wasen't returning the right number of elements.
When viewing the Google Docs editors help file webpage, if your intention is to return the low value of a stock, you are also using the incorrect attribute element to pull this value out. You have used "price" which returns
‘price’ – Real-time price quote, delayed by up to 20 minutes.
but should be using
'low' – The current day's low price.
Again referancing the Google Docs editors help file webpage you can also shorten your date element to only use the TODAY()-30 element instead of entering the a full date string.
As such your origional formula can be changed from:
=MIN(INDEX(GOOGLEFINANCE("NYSE:UBER","price",DATE(MONTH(TODAY()-30,MONTH(TODAY()),DAY(TODAY())), TODAY()),0,2))
to
=MIN(INDEX(GOOGLEFINANCE("NYSE:UBER","price",MONTH(TODAY()-30), TODAY()),0,2))
I have sheet with two tabs and named a ranged where I'm trying to match and select a value in the budget tab based values from the month tab using query. The challenge I'm running into is how to use the dates in the header row of the budget tab in the Where of the query.
Find the value from named range Budget WHERE Category in Month tab matches Category in Budget AND date from Month tab matches date from budget tab, else value in Budget tab column lookup.
I think the sample sheets does a better job of showing this. Thanks in advance for any help.
https://docs.google.com/spreadsheets/d/1heN3I1tWiqBJ0LdHRK-26Koafk_8EudqfMy0cFWxFjI/edit?usp=sharing
I think in this case and the sheet layout it is better to use VLOOKUPs.
Just use this arrayformula across all months
=ARRAYFORMULA(if($H$16:$H="","",if(VLOOKUP($H$16:$H,budget,ifna(match(I$15,Budget!$E$1:$K$1,0),COLUMNS(budget)),false)="", VLOOKUP($H16:$H,budget,columns(budget),false), VLOOKUP($H$16:$H,budget,ifna(match(I$15,Budget!$E$1:$K$1,0),COLUMNS(budget)),false))))
Please note that I expanded the budget named range to cover the entire range, including Category and Lookup columns.
How can I filter the XPath by multiple class to get the data for each year in Table format?
Current code:
=IMPORTXML(CONCATENATE("https://www.google.com/finance/quote/",C2,":NASDAQ"),"//table//tr[contains(#class,'roXhBd')]")
C2 is a reference cell in excel which can be any ticker
Current output
Desired Output
I think GOOGLEFINANCE() formula in Google Sheets is better for this kind of extraction.
You can get many parameters for any ticker:
https://support.google.com/docs/answer/3093281?hl=en
You can import long datasets and parameters in intervals you want and play in your spreadsheet without importxml.
IMPORTXML returns only values that are visible on the website. In order to find a solution, you should find a way to manipulate URL to get you right date ranges. I can't see this option on the site you link.
A number of investments from TIAA.org are not traded on exchanges and not available via a ticker symbol thru say GoogleFinance etc. For one of these I would like to 'scrape' the daily price directly off of TIAA.org website and into a cell auto-magically.
In Google sheets I thought it would be easy enough using ImportHTML as a table but no luck. I've experimented with ImportXML but cannot seem to figure out how to set the xpath query for the specific price I'm interested in and leaving me confused - keep ending up with a "N/A" cell ("Error: Imported content is empty").
Using this URL:
https://www.tiaa.org/public/investment-performance/tiaavariableannuity/profile?ticker=41091375
Could someone take a look and suggest how I might import the daily price (aka unit value) for QREARX into a Google sheet cell using an xpath with ImportXML or other method?
Thanks
If you slightly change your url prefix to https://www.tiaa.org/public/tcfpi/Investment/Portfolio?symbol= and then add your ticket number at the end like you did in your example: 41091375
then you can use this importxml function to pull in the value your looking for:
=IMPORTXML("https://www.tiaa.org/public/tcfpi/Investment/Portfolio?symbol=41091375","//*[#class='first']/text()")
Can some one help me as how to write the correct Xpath to get the different condition prices from this site?
I want the prices $75.00 and $45.00 but when I use //*[#id="price"], I get :
Please answer all questions at left to get your price" while in the Sheets.