Database mail with excel attached with a format way

SVA 121 Reputation points
2023-05-11T05:26:04.3033333+00:00

Hi

How to send a query output in excel with a formatted way in runtime by using EXEC msdb.dbo.Sp_send_dbmail.

SQL Server | Other
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2023-05-11T05:59:31.48+00:00

    Hi @SVA

    Do you want to send the result in excel format?

    You seem to give little information.

    Can this thread help you?

    https://stackoverflow.com/questions/44315299/want-to-execute-sp-send-dbmail-and-send-results-in-excel-format

    Best regards,

    Percy Tang


  2. Olaf Helper 47,586 Reputation points
    2023-05-11T06:41:11.7666667+00:00

    How to send a query output in excel with a formatted way

    You simply can not.

    What do you expect, SQL Server is a database server, not an application server.

    Use an application server or at least a PowerShell script to generate & format an MS Excel file; SQL Server can't do this.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.