How to extract "last updated" date from this URL to google sheets - xpath

I have tried this, but I get three dots
=IMPORTXML("https://covid19.sabah.digital/covid19/","//span[#class='number-last_updated']")

When I saw the HTML data, it seems that the last updated date is displayed by Javascript. By this, unfortunately, the value cannot be directly retrieved with IMPORTXML. This has already been mentioned in the comments.
When I saw the HTML data again, I noticed that the information of date is included in https://data.covid19.sabah.digital/global.json. From this data, how about retrieving the last updated date? In this answer, as a workaround, in order to retrieve the last updated value, I would like to propose to retrieve the data using the following sample formula.
Sample formula:
=TEXT(MAX(ARRAYFORMULA(DATEVALUE(REGEXEXTRACT(QUERY(IMPORTDATA(A1),"SELECT Col1 WHERE Col1 contains 'date'"),"\d{4}-\d{1,2}-\d{1,2}"))))+1,"yyyy-MM-dd")
In this formula, please put the URL of https://data.covid19.sabah.digital/global.json to the cell "A1".
The flow of this formula is as follows.
Retrieve the JSON data using IMPORTDATA.
Retrieve the data values from the retrieved data using QUERY.
Convert the text to the serial number using DATEVALUE.
Retrieve the max value using MAX.
It seems that when this value is added by 1, it is the updated date.
If you don't need this, please remove +1 from the formula.
Convert the serial number to the text using TEXT.
Result:
References:
IMPORTDATA
QUERY
DATEVALUE
MAX
TEXT

Related

How to extract a text from a url while conditionally rendering the images using an Arrayformula in Google Sheets?

This formula below does extract the file ID and yields the correct image url. Now, how to fetch the correct url to extract that ID from by verifying a key using VLOOKUP() maybe?
I've seen that REGEXEXTRACT() requires JOIN() and could this be the reason why it doesn't work?
Current formula doesn't populate the rows, but only the one it's sitting in:
=arrayformula(iferror(image("https://drive.google.com/uc?export=view&id="&regexextract(VLOOKUP($F$3:$F$100,$I:$I,2,0),"d/(.+)/view")),""))
Here's a file for tests, if you feel like operating.
Thank you!
Your formula is working! Just change $I:$I with $I:$J.
You need to put the whole range including the column to look at and the column with the results.

How to filter multiple classes in XPath GoogleSheet ImportXML function to get the desire output

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.

Data Validation Dropdown With Filtered Data Range

I'd like to use data in column D
For a drop down in another sheet (data validation)
Only items where column A is less than 9
I tried List from a range
But it looks like you cannot put a formula in the range box
e.g.
=FILTER(GrpsTY!D2:D, GrpsTY!A2:A < 9)
Any suggestions?
formulas are not supported in data validation. the best course of action is to create a helper column with your filtered entries and then feed it to data validation.
Maybe they have added the functionality since the most recent answer (last July, 2020)?
I'm trying to figure out a formula that will let me validate data using a filtered list, and stumbled onto this:
This image shows that Google Sheets supports data validation using a custom formula
For Criteria, select "Custom formula is" instead of the default, "List from a range".
Hope this helps anyone who comes after me :)

Sort Google Sheets spreadsheet by date, not by string

I use Google Sheets to keep a list of applications I am doing. In each row there is a date field. I want to sort by date now. The first row is frozen using View - Freeze - 1 row. When I select the whole table, press Data - Sort range... and then check Data has header row the sheet is sorted. But not by date but by string. The format of the cells is date. Is only string sorting possible? If yes, I would have to reformat the whole document to dates like 2017-01-11, correct?
The solution was to replace the . by /. Seems as if the common german format using . is not yet supported. Make sure the date is recognized as date. If the cell is right-aligned it worked, if not it did not work.
I learned that you can create a custom date format using the ..
Now the date is entered 10/01/2017 but displayed 10.01.2017. Just the way I wanted.

How to filter a data set by date/time stamp to show only current date data?

I am using new Google Sheet. The data set is this: https://docs.google.com/spreadsheets/d/1LaZXonjnGoseGyrjiVurIaWvAmpVfPA3DiT8p8_KIoc/pubhtml.
(please note that in europe we use ; instead of , in Sheet)
Data comes from a Google Form input.
I need to be able to filter the data set to show only the current date data. Anyone knows how to do that?
You could try using a FILTER() formula to only show the data from today. To do so, write the formula in a new blank sheet as follows:
=ARRAYFORMULA(FILTER('Formularsvar 1'!$A$2:$Y;ROUNDDOWN('Formularsvar 1'!$A$2:$A,0)=TODAY()))
Hope that helps,
Mike

Resources