How to export excel in c#.net on button click

Recommended Answers

You will need to elaborate. What do you mean export excel? Do you have a table of info you want saved to excel?

Jump to Post

All 3 Replies

You will need to elaborate. What do you mean export excel? Do you have a table of info you want saved to excel?

Need to export data from database to Excel? or Excel to Database?

If the former, I think this article http://www.c-sharpcorner.com/UploadFile/83fe73/solutions-to-export-data-from-database-to-excel-in-C-Sharp/ may give you some suggestions.

If the later, I want to introduce my solution with a commercial Excel library to export data from Excel sheet to datatable.

            //Load workbook
            Workbook workbook = new Workbook();
            workbook.LoadFromFile(Server.MapPath("./test.xls"), ExcelVersion.Version97to2003);
            //Export data to datatable
            DataTable dt = workbook.Worksheets[0].ExportDataTable();

Please Reply fast it's urgent..
How to export data from database to Excel in c#.net

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.