How to generating Excel File with multi sheet by using SQL server 2012?

I need to create stored procedure or query or any thing on SQL server 2012 take data table from c# code

and create Excel file with multi sheet based on data Exist on data table .

From data below as Example I have Function GetDate return data table .

Create File ABC.xlsx with two sheet first sheet name source and second sheet name types

and load data related to every sheet based on data .

so Result will be Create file Abc.xlsx with two sheets source and Types and every sheet have one

public static DataTable GetData() 
            DataTable dataTable = new DataTable();
            dataTable.Columns.Add("PartId", typeof(int));
            dataTable.Columns.Add("Company", typeof(string));
            dataTable.Columns.Add("Files", typeof(string));
            dataTable.Columns.Add("Tab", typeof(string));

            dataTable.Rows.Add(1321, "silicon", "Abc", "Types");
            return dataTable;

Are SQL server 2012 can create Excel File with multi sheet or not ?

I can do that by c# but from SQL cannot

so How can I achieve that from SQL server 2012 by any way ?

A post was split to a new topic: Learning C#

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.