Run Excel Macro via xp_cmdshell

  • I created an excel spreadsheet via xp_cmdshell. I would now like to format this into a more user friendly file. Is it possible to use xp_cmdshell to open the file, run a macro that will format it and save it? I'm looking to expand my columns and add some colors. Is there a better way to do this?

  • If you create a macro within a spreadsheet and call it 'auto_open' it will run each time it is opened, but that would depend on how your spreadsheet gets created.

    But can I ask why you are using xp_cmdshell in the first place?

  • I'm not physically opening the excel spreadsheet. I created a stored procedure that exports data to excel and then attaches it as an email.

    I found a workaround for this. Instead of using excel, I created an html file instead.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply