How to grab web data into Numbers sheet from Google finance
Hello, here I go again, now I am trying to grab the value out of a webpage https://www.google.com/finance/quote/ACS:BME to paste it in the Numbers sheet that I am using.
The data is the is the actual price value in the site, located underneath "Grupo ACS".
The script that I am using now for other quote, grabs the data, opens the numbers file and paste the data:
--------------------------------------
set mySheetName to "2020"
set myTableName to "Tabla 1"
set tgtCell to "J26"
set theHtml to do shell script "curl -s " & quoted form of "https://www.bolsasymercados.es/MTF_Equity/esp/SICAV/Ficha/ACATES_SISAPON__SICAV__S_A__ES0176200030.aspx"
set text item delimiters to {"<div class=\"row fechaPreciosSup\">", "<div class=\"row fechaPrecio\">"}
set the extractedDivs to theHtml's text item 2 -- item 2 is the relevant section of the html
set text item delimiters to {"<p>", "</p>"} -- remove the p tags
set tempLst to text items of extractedDivs
set text item delimiters to ""
set tempStr to tempLst as text
set text item delimiters to {"<div class=\"col-md-6 col-sm-6 col-xs-6\">"}
set theValue to first word of text item 3 of tempStr
set the clipboard to theValue
-- return theValue -- uncomment this line for testing -- will appear in Result pane
tell application "Numbers"
open "/Users/ricardo/Library/Mobile Documents/com~apple~Numbers/Documents/ES Acciones.numbers"
end tell
tell application "Numbers"
tell front document
tell active sheet to set currSheet to its name # save current location
tell sheet mySheetName to tell table myTableName
activate
set selection range to range tgtCell
delay 0.3
tell application "System Events" to keystroke "v" using {option down, shift down, command down}
end tell
activate
set active sheet to sheet currSheet # go back to original location
end tell
end tell
--------------------------------
I tried other sites, but google finances seams a simpler site to make it work, but I a have not been able to make it work.
Any ideas?
Thanks in advance