EasyXLS

How to export DataGridView to Excel file in C# and VB.NET

Concept

EasyXLS™ library allows you to export a DataGridView to an Excel file. The exported data in cells can be formatted.

EasyXLS can be successfully used inclusively to export large Excel files having big volume of data with fast exporting time.

EasyXLS allows you to export Excel files without Excel installed, without Interop or any other additional software installed.

Concept in action

The below example shows how to export DataGridView to Excel in C# and VB.NET from a winform windows application.

Source code sample

C#.NET
VB.NET

Formatting cells

EasyXLS™ enables you to format cells, rows and columns in order to set the fonts and colors.

Export DataGridView to XLSX, XLSB, XLSM and XLS files

This code sample shows how to export a DataGridView to XLS file. In a similar way, you can export a DataGridView to XLSX file using ExcelDocument.easy_WriteXLSXFile_FromDataSet method or export DataGridView to XLSB file using ExcelDocument.easy_WriteXLSBFile_FromDataSet method.

Export DataGridView to Excel file with multiple sheets

EasyXLS enables you to create multiple sheets for the Excel file and insert the DataGridView inside a specific sheet.

Export DataTable of DataGridView to Excel file

If the data source of the DataGridView is a DataTable, like in the above sample, the data can be also exported directly from the DataTable.

Getting started with EasyXLS Excel library

To download the trial version of EasyXLS Excel Library, press the below button:

Download EasyXLS™ Excel Library for .NET

If you already own a license key, you may login and download EasyXLS from your account.

After installation, you will need to create a C# or VB.NET project and add a reference to EasyXLS.dll.



Available for: Professional, Excel Writer, Express Excel Writer
Go to top

EasyXLS Excel libraries:

.NET
.NET Excel Library
full .NET version to import, export or convert Excel files
.NET Excel Writer
.NET version to create and export Excel files
.NET Express Excel Writer
limited .NET version to create and export Excel files in predefined formats
Download EasyXLS™ Excel Library for .NET

File formats:

MS Excel 97
MS Excel 2003
MS Excel 2007
MS Excel 2010
MS Excel 2013
MS Excel 2016
XLS XLSX XLSM XLSB
XML HTML CSV TXT