Business Users just love Excel, no matter what great tools are out there (Tableau, Power BI, etc), you just cannot get away from it. Sometimes its because they are used to the Excel workflow and are resisting change, while other times it is because the embedded power of VBA macros allows them to do all sorts of weird and wonderful things to the the data. So Excel is here to stay, no matter what your desires.
A few times I've needed to get data out of a SQL Server database into the Excel Workbook. There are a few ways to do this in Excel, one being using the Get External Data toos on the Data ribbon. This post is going to show you how to do it via an Excel VBA Macro.
Note: The above code uses "Range("B2").CopyFromRecordset rs", which is a super quick and easy way to populate the data within a recordset onto a worksheet. This is a much simpler method than using loops to parse the data in the recordset that many examples online seem to do.
Business Intelligence Lead.