Powershell: Filling up an Existing Excel Sheet with data from SQL Server
Situation: The client required to have data from their SQL Server 2012 Database filled in to an existing Excel Sheet. This sheet had a table with around 40 columns of which 12 where to be filled by us and rest from different departments. I tried different solution for that since the requirements were not initially clear. Forexample OPENROWSET was tried. In this regards this link really helpful. Although this requires few configuration to be made on the server or to install e.g. ACE.OLEDB driver on server which was not possible in our case. So we decided to write a Powershell script and access SQL Now about the script: Take the file TestExcel.xlsx from C:\Temp folder Create its copy with the current date appended to its name. Start reading the Excel file from Sheet "Specified Sheet Name" From Columns 1, it will take the name of the system. Based on the name fill the excel sheet by executing the queries, here are the columns that are going to ...
Comments
Post a Comment