Scheduled reports by email
Hi arikfr,
Does the re:dash project support the daily email reports?
@Thomasmisfit not at the moment, but it's high on the list of next things to implement.
:+1:
Any thoughts when this might get on the roadmap again? It'll be a pretty neat feature to have.
@thelazyenginerd it's on the roadmap, but I can't commit on specific dates for feature releases.
@arikfr this would be really good feature to have.
@ChiragKParmar I agree :-)
@arikfr - Would this flow be ideal?
- Run a cron to query the DB at said time interval.
- Save the query result in a file (Somewhere in /opt/redash folders).
- Run a python job to pick up that file , attach it and send email to designated email address
@shahneil88 it's possible, but then why use Redash? IMO, a better approach would be to get the query result from Redash via the API, and send it by email.
I even have an example script that does that: https://gist.github.com/arikfr/a730451c01d1dd326412
@arikfr has this feature implemented?
+1
@alenave it wouldn't be open if it was implemented...
@arikfr thanks for the script! going to adapt for my org now.
+1
+1
+1
+1 a much awaited feature for ReDash
+1
+1
+1
+1
+1
+1
+1
+1
Thanks all. Please do not post +1s: we know this is an open issue. :)
@arikfr suggested we use the API to email the report as CSV. That is ok but the killer feature is to email a specific configured dash board with charts, graphs and the raw CSV report data on an interval (nightly or weekly). Sure we can write code to scrape the dashboard HTML and use that as our email body but it isn't as nice
+1
I was able to cobble something together using Zapier that does this. Not ideal but I thought I'd share this workaround for anyone who wants it in the meantime:
Trigger: Schedule (Every Week)
You can get {query id} (a number) and {api key} (a random alphanumeric string) from them embed URL of the query.
Action: WebHooks by Zapier -> GET
URL
https://redash.vaultdrop.com/api/queries/{query id}/results.csv
Query String Params
api_key = ...
Send as JSON
No
Action: Code by Zapier > JavaScript
Code
output = {html: `
<html>
<body>
<table colspacing=0 colpadding=0>
<thead>
<tr>
${inputData.csv.split('\n')[0].split(',').map(h => `<th style="text-align: right; padding: 2px">${h}</th>`).join('\n ')}
</tr>
</thead>
<tbody>
${inputData.csv.split('\n').splice(1).map(
(line, n) => `<tr>\n${line.split(',').map(v => `<td style="text-align: right; padding: 2px; background-color:${n&1?'#f2f2f2':'white'}">${v}</td>`).join('\n')}</tr>`).join('\n')}
</tbody>
</table>
</body>
</html>
`
};
Action: Mandrill > Send Email
Put the HTML output into the message body. Other mail sending methods that support HTML will work as well.
Actually with Zapier you need a paid plan to really use it well for this purpose. I created a serverless AWS project that can be used to run a report and email it on a schedule, since I don't have any other use for Zapier right now:
https://github.com/dobesv/redash-scheduled-email
Hey guys i managed to send reports of each query in CSV form in mail, Please is there a way to send reports in png screenshots form.