IronXL.Excel 2019.3.2.1

IronXL - The C# Excel SpreadSheet Library.

IronXL allows developers to Read, Generate and Edit Excel (and other Spreadsheet files) in .Net Applications & websites.

A fast and natural approach to work with Excel and Other Spreadsheet files in C#.

No utilization of Office Excel Interop. Works well with .NET Framework, .NET Core and Azure. All without extra dependancies or the need to install MS Office.

Key library features include:
* Import Data from XLS/XLSX/CSV/TSV.
* Export Work Sheets to XLS/XLSX/CSV/TSV/JSON.
* Work with Spreadsheets as System.Data.DataSet and System.Data.DataTable objects.
* Excel Formulas recalculated every time a sheet it edited.
* Intuitive Ranges setting with a WorkSheet[“A1:B10”] syntax.
* Sort Ranges, Columns and Rows.
* Style Cells - Font, Size, Background pattern, Border, Alignment and Number formats.

IronXL works well in C#, VB.NET, MVC, ASP.NET projects for Websites, Console & Desktop APPs.

Requires .Net Core 2.x or Framework 4.x.   Works with Xamarin, SharePoint, Mono and Cloud hosting services such as Microsoft Azure.

Licensing & Support available for commercial deployments.

For code samples, docs & more visit https://ironsoftware.com/csharp/excel/

For support please contact us: developers@ironsoftware.com

There is a newer prerelease version of this package available.
See the version list below for details.
Install-Package IronXL.Excel -Version 2019.3.2.1
dotnet add package IronXL.Excel --version 2019.3.2.1
<PackageReference Include="IronXL.Excel" Version="2019.3.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IronXL.Excel --version 2019.3.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
 static void ReadXlsxFile()
        {
          
            //You can read XLS files in the same way.
            //Other supported formats for reading are: CSV, TSV
            WorkBook workbook = WorkBook.Load("test.xlsx");
            workbook.Metadata.Author = "IronXL";
            //Other workbook operations...
            WorkSheet sheet = workbook.WorkSheets.First();

            var myvalue = sheet["A2"].DecimalValue;

        }

        static void ExportAndImportToExcel()
        {
            //This is how you import excel file, same for xlsx
            WorkBook workbook = WorkBook.Load("test.xls");
            workbook.CreateWorkSheet("new_sheet");
            workbook.Metadata.Title = "Import&Export Example";

            //You can export to both formats with fluent saving
            //Other supported formats for saving are: CSV, TSV, JSON, XML
            workbook.SaveAs("ExportAndImportToExcel.xls");
        }

        static void GetRangeInExcel()
        {
            WorkBook workbook = WorkBook.Load("test.xls");
            WorkSheet sheet = workbook.WorkSheets.First();

            //This is how we get range from Excel worksheet
            var range = sheet["A2:A8"];
            //This is how we can iterate over our range
            foreach (var cell in range)
            {
                Console.WriteLine(cell.Value);
            }

            var oneMoreRange = sheet["A9:A10"];
            //This is how we can combine our ranges
            var resultRange = range + oneMoreRange;

            //Iterate over new range
            foreach (var cell in resultRange)
            {
                Console.WriteLine(cell.Value);
            }
        }

        static void ExcelXlsxToDatatable()
        {
            WorkBook workbook = WorkBook.Load("test.xls");
            WorkSheet sheet = workbook.DefaultWorkSheet;

            //This is how you convert your worksheet to DataTable
            //Boolean parameter allows you to set whether you want to treat your first row as column names of your table.
            //The default value is false
            var dataTable = sheet.ToDataTable(true);

            foreach (DataRow row in dataTable.Rows)
            {
                for (int i = 0; i < dataTable.Columns.Count; i++)
                {
                    Console.Write(row[i]);
                }
            }
            Console.WriteLine();

            //Also you can convert the whole workbook to DataSet and work with it the way you like.
            var dataSet = workbook.ToDataSet();
            foreach (DataTable table in dataSet.Tables)
            {
                Console.WriteLine(table.TableName);
            }
        }

        static void CreateExcelWorksheet()
        {
            WorkBook workBook = WorkBook.Load("test.xlsx");
            //This is how we create new worksheet
            var newSheet = workBook.CreateWorkSheet("new_sheet");
            //You can perform any operations you want with the new sheet.
            newSheet["B2"].Value = DateTime.Now;
        }

        static void GenerateExcelFile()
        {
            //This is how we create new workbook. Default file format is XLSX, we can override it using CreatingOptions
            WorkBook xlsWorkbook = WorkBook.Create( ExcelFileFormat.XLS );
            //This is how we create new worksheet
            WorkSheet xlsSheet = xlsWorkbook.CreateWorkSheet("new_sheet");
            //Add data and styles to the new worksheet
            xlsSheet["A1"].Value = "Hello World";
            xlsSheet["A2"].Style.BottomBorder.SetColor("#123456");
            xlsSheet["A2"].Style.BottomBorder.Type = IronXL.Styles.BorderType.Double;

            //Save generated excel file
            xlsWorkbook.SaveAs("GenerateExcelFile.xls");
        }
 static void ReadXlsxFile()
        {
          
            //You can read XLS files in the same way.
            //Other supported formats for reading are: CSV, TSV
            WorkBook workbook = WorkBook.Load("test.xlsx");
            workbook.Metadata.Author = "IronXL";
            //Other workbook operations...
            WorkSheet sheet = workbook.WorkSheets.First();

            var myvalue = sheet["A2"].DecimalValue;

        }

        static void ExportAndImportToExcel()
        {
            //This is how you import excel file, same for xlsx
            WorkBook workbook = WorkBook.Load("test.xls");
            workbook.CreateWorkSheet("new_sheet");
            workbook.Metadata.Title = "Import&Export Example";

            //You can export to both formats with fluent saving
            //Other supported formats for saving are: CSV, TSV, JSON, XML
            workbook.SaveAs("ExportAndImportToExcel.xls");
        }

        static void GetRangeInExcel()
        {
            WorkBook workbook = WorkBook.Load("test.xls");
            WorkSheet sheet = workbook.WorkSheets.First();

            //This is how we get range from Excel worksheet
            var range = sheet["A2:A8"];
            //This is how we can iterate over our range
            foreach (var cell in range)
            {
                Console.WriteLine(cell.Value);
            }

            var oneMoreRange = sheet["A9:A10"];
            //This is how we can combine our ranges
            var resultRange = range + oneMoreRange;

            //Iterate over new range
            foreach (var cell in resultRange)
            {
                Console.WriteLine(cell.Value);
            }
        }

        static void ExcelXlsxToDatatable()
        {
            WorkBook workbook = WorkBook.Load("test.xls");
            WorkSheet sheet = workbook.DefaultWorkSheet;

            //This is how you convert your worksheet to DataTable
            //Boolean parameter allows you to set whether you want to treat your first row as column names of your table.
            //The default value is false
            var dataTable = sheet.ToDataTable(true);

            foreach (DataRow row in dataTable.Rows)
            {
                for (int i = 0; i < dataTable.Columns.Count; i++)
                {
                    Console.Write(row[i]);
                }
            }
            Console.WriteLine();

            //Also you can convert the whole workbook to DataSet and work with it the way you like.
            var dataSet = workbook.ToDataSet();
            foreach (DataTable table in dataSet.Tables)
            {
                Console.WriteLine(table.TableName);
            }
        }

        static void CreateExcelWorksheet()
        {
            WorkBook workBook = WorkBook.Load("test.xlsx");
            //This is how we create new worksheet
            var newSheet = workBook.CreateWorkSheet("new_sheet");
            //You can perform any operations you want with the new sheet.
            newSheet["B2"].Value = DateTime.Now;
        }

        static void GenerateExcelFile()
        {
            //This is how we create new workbook. Default file format is XLSX, we can override it using CreatingOptions
            WorkBook xlsWorkbook = WorkBook.Create( ExcelFileFormat.XLS );
            //This is how we create new worksheet
            WorkSheet xlsSheet = xlsWorkbook.CreateWorkSheet("new_sheet");
            //Add data and styles to the new worksheet
            xlsSheet["A1"].Value = "Hello World";
            xlsSheet["A2"].Style.BottomBorder.SetColor("#123456");
            xlsSheet["A2"].Style.BottomBorder.Type = IronXL.Styles.BorderType.Double;

            //Save generated excel file
            xlsWorkbook.SaveAs("GenerateExcelFile.xls");
        }

Release Notes

New Release of IronXL Excel library for .Net

Supports Framework 4.5+ and Core 2.0+

- Logical API designed for developer usability.
- Create, Open, Edit, Recalculate, Export and Save Implemented for XLSX and XLS
- Cell Styling
- Live Formula Recalculation

Dependencies

This package has no dependencies.

Version History

Version Downloads Last updated
2019.4.1.2-beta 67 6/6/2019
2019.3.2.1 114 5/21/2019