25.02.2018, 14:31
(25.02.2018, 11:46)buuuudzik Wrote: Please update library, This should work:
Code:require('user.trends_pro')
-- Export data
name = 'Kitchen_Temperature'
dates = {}
dates['start'] = { year=2017, month=4, day=5, hour=0}
dates['end'] = "now"
name, csv = trend_export(name, dates, 'csv')
-- Send an email with data
attachement = { {filename=name .. '.csv', filedata=csv, mimetype='text/csv'} }
mailattach('example@gmail.com', 'Report from trend ' .. name, 'CSV file attached', attachement)
script.disable(_SCRIPTNAME)
The result is mail with csv which has such content: