0

I run a long query each morning in Microsoft SQL Server Management Studio, and manually update an excel spread sheet with the results.

Is there a way I can automate this process using built in features in SQL Server Management Studio? If not, what can I do to automate the manual entering of the script, and updating the results in the excel file?

  • I wouldn't recommenced this method, but you could use a macro from within Excel that does it for you – dbajtr Oct 06 '17 at 12:42
  • Does anything further happen with the Excel sheet, or is it just a sheet people look at to know the current status? You can add a connection in the Excel sheet that will automatically update a sheet when opening or when clicking refresh. – Scarygami Oct 06 '17 at 12:44
  • check out what i used for a similar problem https://stackoverflow.com/a/45616221/8411349 – PeterH Oct 06 '17 at 12:51
  • I use the sheet as a “dashboard”. Just a way for people to gain information which the query provides. Thanks for these responses. – user8732367 Oct 06 '17 at 13:41

1 Answers1

0

This is not supported by Microsoft but....

As long as your Excel document doesn't change, you can use PowerShell to open Excel and edit the document. I have done this to create a database server document that contains a page for each server with information from multiple sources (Disks - both size and usage, Memory - both total and used by SQL, CPUs, information about databases, etc.). I then run the PowerShell on a scheduled task every morning before I get to work so it is up to date when I get in.

This wasn't terribly easy to create. Took a lot of googling but I was learning PowerShell at the same time.

SteveB
  • 769
  • 4
  • 18