Google spreadsheet ImportXML - google-sheets

I'm trying to get the lowest product price from this site into a Google spreadsheet.
https://multimedialne-centra.heureka.sk/homatics-dongle-q/
I don't know how to enter the condition but it should be something like this:
From the first <a> with the parameter data-gtm-position-type="free" take the value from SPAN with class="c-offer-v3__price"
But how to define it in a spreadsheet?

You can use importxml for this. If just a lowest price is o.k. for you then you can write:
=min(importxml("https://multimedialne-centra.heureka.sk/homatics-dongle-q/";"//span[#class="c-offer-v3__price u-bold u-delta"]"))
It takes all the values from corresponding xpath and extracts lowest of them.

Related

Very Specific Filtering in Google Sheets

I am making a calculator in Google sheets and I would like to find a formula or script or something that will allow me to read the value of a certain square and add the formula "=sum(C5:C9)" or "=product(C5:C9)" or whichever depending on what the person puts in C4. Not sure if this is possible in google sheets (without custom code), but if it is, that would be great!
try:
=IF(C4="*"; PRODUCT(C5:C9); SUM(C5:C9))

Extract html table row to google sheet

I’m trying to extract a single row from a table
When using the google sheet importhtml function, I get the whole table.
=IMPORTHTML("https://www.marketwatch.com/investing/stock/jwn/options?mod=mw_quote_tab", "table",1)
How can I extract just the row right above the word “ Current price as of “
So e.g. in this case the row will have the data below. (this data will change as the date changes)
quote 1.5 0.53 76 1.36 1.47 142 39 quote 0.88 -1.73 23
I have several urls to go thorough
So e.g if I put the following url then the row position will change.
https://www.marketwatch.com/investing/stock/ge/options
Any idea how to extract that just last row right above the word “ Current price as of “
When I saw the HTML data from the URL of https://www.marketwatch.com/investing/stock/ge/options, I thought that the value you expect might be able to be retrieved using IMPORTXML and a xpath. So in this answer, I would like to propose to use IMPORTXML.
Sample formula:
=IMPORTXML(A1,"//tr[td[1]/#class='acenter inthemoney'][last()]")
In this case, the URL of https://www.marketwatch.com/investing/stock/ge/options is put in the cell "A1".
Result:
Note:
This sample formula can be used for the current URL of https://www.marketwatch.com/investing/stock/ge/options. So when the URL is changed and the HTML structure is changed by updated of the site, the formula might not be able to be used. So please careful this.
Reference:
IMPORTXML
ImportHTML() simply allows you to read an (entire!) HTML table or list into your Google sheet.
If you want to filter or manipulate the imported data, then you'll need to use other Google Sheets functions. These are documented here:
Google Sheets function list
Alternatively, you might want to "import" input one sheet, then select certain data into another, separate sheet:
Get data from other sheets in your spreadsheet
Here are some examples for "filtering" your data:
FILTER function

How can I get single sheet from a spreadsheet collection from Google Sheets with Google Sheets API v4?

I'm trying to build a webapp based on Google Sheets. I'm a little bit confused with the API. I have a spreadsheet which is shared with me by Drive and contains 2 sheets. I can get the first sheet with
GET /v4/spreadsheets/{spreadsheetId}
Returns the spreadsheet at the given ID.
endpoint. But I couldn't figure out how to get the second sheet. Is there a way I can get spesific sheet from a spreadsheet?
The problem in here is when you are using ranges parameter you have to specify the sheet title with A1 notation syntax as described in this document: https://developers.google.com/sheets/guides/concepts#sheet_id
I was using the ranges parameter and using the A1 notation correctly but I wasn't specifying the sheet title. In that scenario the default sheet is the first one. If you want the get another sheet other than the first one you have to specify the title, like this:
https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}?ranges=sheetTitle!A3:F20

Search google for domain of company in sheets

I have a google sheet with nearly 4500 company names in column A. I'd like to write a script that searches google for the companies URL and to return that URL in column B
You want to find the company's official website? I cannot do that, but if you only want a google query, you can use this formula, though I don't think this is what you want :
=HYPERLINK(CONCATENATE("http://www.google.com/search?q=",A1),A1)
You might also look at the GOOGLEFINANCE function on the formula help page.

Google Sheets COUNTIF / COUNTIFS formulas based on multiple criteria

I'm looking for some expertise with formulas. I've got a raw data source and need to be able to summarise it in a separate sheet based on a number of different variables of both number and text formats. I've tried some COUNTIFS, INDEX and other formulas that I've seen published on this site, but it's just not working the way I need it to.
The column headings are:
Timestamp
HRBP (name)
Date
Area name
Team name
Enquiry Type
Enquiry Summary
The summary data I need is:
Total number of Enquiry Type by HRBP by Area between specified date range, where I can enter the value of HRBP, Area, and dates in defined cells, and the 'count' of Enquiry Type will be displayed below (and then I can create graphs/charts).
My logic would be something along the lines of:
COUNT [Enquiry Type] IF ([HRBP = 'x'] AND [AREA = 'y'] AND [Date >='z'] AND [DATE <= 'a'])
Can someone please help get to my end goal? Or does anyone know of an App solution that could create this analysis easily enough - the data is entered via a Google Form at front end.
I think COUNTIFS is what you're looking for. In my dummy data I used this formula:
=countifs(B:B,"a",C:C,"x",D:D,"y",E:E,">=7/30/2015",E:E,"<=7/31/2015")
It's put in the cell G2 in the image:

Resources