Send SQL Server data to email as CSV weekly
Recipe ToolsMarketingDatabaseData ParserUtilitiesProductivitySales Enablement
What it does
When the scheduler runs every week, this automation queries SQL Server for rows in the Contacts table and composes a CSV file. It sends the CSV as an email attachment so someone receives the data on schedule.
Who it's for
Data and analytics teams who need to distribute SQL Server reports via email without manual exports.
How teams use this
Distribute weekly contact reports
Export Contacts from SQL Server and email a CSV every Sunday morning so the team has fresh data without opening the database.
Send reports to external stakeholders
Change the recipient email address in Gmail so the weekly CSV goes to a partner or client instead of an internal team distribution list.
Filter contacts by region before export
Add a condition to the SQL query so only contacts from a specific region are included in the CSV attachment sent via Gmail each week.
How it works
- Run on a weekly schedule. Start this automation every week at 12:00 AM on Sunday so the report sends on a predictable cadence.
- Query the Contacts table. Select rows from the dbo.Contacts table in SQL Server to retrieve the data that will be exported.
- Compose the CSV file. Create a CSV file from the list of records returned by the SQL query so the data is formatted for email delivery.
- Send the CSV via email. Send an email through Gmail with the CSV file attached so someone receives the Contacts data in their inbox.