Forum Discussion
Tim Hunter
Jul 21, 2021Iron Contributor
Automate SQL query to send excel spreadsheet via email
I have this SQL query that runs perfect. I now would like to automate it as a stored procedure that emails the results in an Excel spreadsheet. Any pointer? Thanks for any help you can provide. H...
AnatoliD
Jul 22, 2021Copper Contributor
https://www.sqlservercentral.com/scripts/create-excel-xls-from-t-sql
It creates excel file, you can send it as attachment.
The script is very old, you will need replace in this script "Microsoft.Jet.OLEDB.4.0" to "Microsoft.ACE.OLEDB.12.0"
and install "Microsoft Access Database Engine 2010 Redistributable " x32 or x64 - depending what version of Office you have installed.