← All use cases
Monthly finance pack
Finance wants the same workbook every month: one tab per cut of the data, money formatted properly, and it has to land in their inbox without anyone remembering to send it. You write the SQL once and describe the workbook in YAML.


↓ Download the workbook (finance_pack.xlsx)
queries:
- {query: finance_regions, tab_name: By region}
- {query: finance_channels, tab_name: By channel}
- {query: finance_products, tab_name: Top products}
output:
format: xlsx
columns:
net: {format: "#,##0.00"}
destination:
- {profile: local, path: "out/finance_pack.xlsx"}
- profile: mail_local
to: finance@dre-demo.test
cc: cfo@dre-demo.test
subject: "Sales {{ period(var('period')).start.date }} to {{ period(var('period')).end.date }}"
attachment_name: "Sales pack {{ run.date.yyyymmdd }}.xlsx"{% set p = period(var('period')) %}
select
region_name,
count(distinct order_id) as orders,
sum(qty) as units,
sum(net_amount) as net
from {{ ref('paid_order_facts') }}
where order_date between '{{ p.start.date }}' and '{{ p.end.date }}'
group by 1 order by 1dre run finance_pack