Skip to content
Home » sql2xls goes cross-platform

sql2xls goes cross-platform

  • by

Last year I released sql2xls, a free open-source tool which lets you throw a bunch of scripts into a folder, run them automatically against SQL Server and get the results back in a nicely-formatted Excel file, one tab per script.

A year later, I am happy to announce that the tool now runs cross-platform. You can compile and run it with .NET Core 3.1 LTS to run on Windows, macOS, and Linux. It uses the new Microsoft.Data.SqlClient library from NuGet, as well as the latest beta of ClosedXML.

Worth noting is that ClosedXML has a dependency on the System.Drawing library. If you use macOS, you will need to install mono-libgdiplus, and on Linux you’ll need libgdiplus. Scott Hanselman explains more in his post How do you use System.Drawing in .NET Core? if you’re curious.

Please visit the GitHub repository and give it a look. Here’s a sample of the output on macOS Catalina:

~$ dotnet sql2xls.dll
--- SQL to Excel Exporter v0.2.0
--- Copyright (c) Born SQL
--- Written by Randolph West and other contributors.

[01:12:30] *** [INFO] Opened connection to 0
Installing stored procedure from file [sp_Blitz.sql] in database [master]...
Running script [version.sql] in database [master]
Running script [sp_Blitz.sql] in database [master]
Writing worksheet 0...
Writing worksheet 1...
Saving output...
Excel file [d50c73533f21412aac2892096bc8e7d8_master.xlsx] generated in folder [/tmp].
Press any key to exit.

Please leave your thoughts in the comments below.