This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Get prices from webpage via Excel
#5
Code:
now = os.date('*t')
pickhour = (now.hour + 1)

require('json')
require('ssl.https')

res = ssl.https.request('https://www.nordpoolgroup.com/api/marketdata/page/23?currency=NOK')
values = {}

if res then
 res = json.pdecode(res)

 if type(res) == 'table' then
   for _, row in ipairs(res.data.Rows) do
     cols = row.Columns
     value = cols[ 1 ].Value:gsub(',', '.')
     values[ #values + 1 ] = tonumber(value)
   end
 end
end

log(values[pickhour])
This seems to work, run it as a scheduled script 1 minute over every hour.
But with the current link in there, it looks like it's getting prices for the next day`?

Best regards, Jørn.
Reply


Messages In This Thread
Get prices from webpage via Excel - by Rune - 02.05.2018, 18:57
RE: Get prices from webpage via Excel - by Jørn - 05.05.2018, 18:35

Forum Jump: