Automatically email admin report CSVs on a recurring cadence

I figured out the query to run in Data Explorer, it is:

SELECT term, count(*) searches, 
 sum(case when search_result_id is not null then 1 else 0 end) clicks,
 round(sum(case when search_result_id is not null then 1 else 0 end) * 100.0 / count(*), 1) as ctr
from search_logs
where created_at > current_timestamp - interval '30' day
group by term
order by count(*) desc

So my final, final question is: is there a way in the Automation, to have this query run and turn the results into a CSV attached to the email for the recipients instead of the results posted in the body of the email?

2 Likes