IronXL How-Tos Convert Spreadsheet File Types How to Convert Spreadsheet File Types Chaknith Bin Updated:June 22, 2025 Introduction IronXL supports the conversion of spreadsheet files between various formats, including XLS, XLSX, XLSM, XLTX, CSV, TSV, JSON, XML, and HTML. It also provides support for inline code data types such as HTML string, Binary, Byte array, Data set, and Memory stream. The Load method is used to open a spreadsheet file, and the SaveAs method is used to export the spreadsheet to the desired file type. How to Convert and Export (XLSX, XLS, XLSM, XLTX, CSV) in C# Install the C# library for converting Excel files to other file formats Use the WorkBook class to load or create new XLS or XLSX View, add, or modify data in the Excel spreadsheet using C# Utilize the methods in the WorkBook class to export the spreadsheet Check the exported file in the specified directory Get started with IronXL Start using IronXL in your project today with a free trial. First Step: Start for Free Convert Spreadsheet Type Example The process of converting spreadsheet types involves loading a file in one supported format and exporting it to another format using IronXL's intelligent data restructuring capabilities. While the SaveAs method can be used to export to CSV, JSON, XML, and HTML, it is recommended to use the dedicated methods for each file format: SaveAsCsv SaveAsJson SaveAsXml ExportToHtml Please noteFor CSV, TSV, JSON, and XML file formats, a separate file will be created for each worksheet. The naming convention follows the format fileName.sheetName.format. In the example below, the output for the CSV format would be sample.new_sheet.csv. :path=/static-assets/excel/content-code-examples/how-to/convert-spreadsheet-file-types-different-format.cs // Example C# code to convert an Excel spreadsheet to different formats using IronXL using IronXL; // Load the Excel spreadsheet WorkBook workbook = WorkBook.Load("sample.xlsx"); // Convert and save as CSV workbook.SaveAsCsv("sample.csv"); // Convert and save as JSON workbook.SaveAsJson("sample.json"); // Convert and save as XML workbook.SaveAsXml("sample.xml"); // Convert and export to HTML workbook.ExportToHtml("sample.html"); // The files will be saved in the project's directory with the specified formats ' Example C# code to convert an Excel spreadsheet to different formats using IronXL Imports IronXL ' Load the Excel spreadsheet Private workbook As WorkBook = WorkBook.Load("sample.xlsx") ' Convert and save as CSV workbook.SaveAsCsv("sample.csv") ' Convert and save as JSON workbook.SaveAsJson("sample.json") ' Convert and save as XML workbook.SaveAsXml("sample.xml") ' Convert and export to HTML workbook.ExportToHtml("sample.html") ' The files will be saved in the project's directory with the specified formats $vbLabelText $csharpLabel Advanced In the previous section, we explored the most common file formats for conversion. However, IronXL has the capability to convert spreadsheets to many more formats. Explore all the available options for loading and exporting spreadsheets. Load XLS, XLSX, XLSM, and XLTX CSV TSV Export XLS, XLSX, and XLSM CSV and TSV JSON XML HTML Inline code data types: HTML string Binary and Byte array Data set: Exporting Excel into System.Data.DataSet and System.Data.DataTable objects allows easy interoperability or integration with DataGrids, SQL, and EF. Memory stream The inline code data types can be sent as a RESTful API response or used with IronPDF to convert them into a PDF document. :path=/static-assets/excel/content-code-examples/how-to/convert-spreadsheet-file-types-different-format-advanced.cs // Advanced example: converting an XLSX file to multiple formats using IronXL using IronXL; // Load the Excel spreadsheet WorkBook workbook = WorkBook.Load("advanced_sample.xlsx"); // Convert and save to various formats workbook.SaveAs("advanced_sample.xlsm"); workbook.SaveAsCsv("advanced_sample.csv"); workbook.SaveAsJson("advanced_sample.json"); workbook.SaveAsXml("advanced_sample.xml"); workbook.ExportToHtml("advanced_sample.html"); // You can also convert to binary or byte array for advanced uses byte[] excelAsByteArray = workbook.ToBinaryData(); $vbLabelText $csharpLabel The code above loads an ordinary XLSX file, then converts and exports it to several formats. The Spreadsheet We Will Convert XLSX file The various files exported are shown below. TSV File Export CSV File Export JSON File Export XML File Export HTML File Export Frequently Asked Questions How can I convert a spreadsheet to CSV using C#? You can convert a spreadsheet to CSV using the `SaveAsCsv` method provided by the IronXL library. Simply load your Excel file using the `WorkBook.Load` method and call `SaveAsCsv` to export it. What formats can be exported using IronXL? IronXL allows exporting spreadsheets to several formats including CSV, TSV, JSON, XML, and HTML using respective methods like `SaveAsCsv`, `SaveAsTsv`, `SaveAsJson`, `SaveAsXml`, and `ExportToHtml`. How do you load an Excel file for conversion in C#? To load an Excel file in C#, use the `WorkBook.Load` method in the IronXL library. This method supports various Excel formats such as XLS, XLSX, and more. Can IronXL handle data conversion to JSON? Yes, IronXL can convert spreadsheet data to JSON format using the `SaveAsJson` method. This allows easy data manipulation and integration with web applications. Is it possible to export an Excel file to HTML? Yes, using IronXL, you can export an Excel file to HTML format with the `ExportToHtml` method. This is useful for web presentations of spreadsheet data. What is the role of the `WorkBook` class in IronXL? The `WorkBook` class in IronXL is used to load and manipulate Excel files, allowing you to view, modify, and export data to various formats. How can you ensure the exported data is correct? After exporting using IronXL methods like `SaveAsCsv` or `SaveAsJson`, you can verify the output by checking the saved files in the specified directory to ensure accuracy. Can IronXL export spreadsheet data to XML? Yes, IronXL supports exporting spreadsheet data to XML format using the `SaveAsXml` method, facilitating integration with systems that require XML input. How do you install IronXL for converting Excel files in a C# project? IronXL can be installed in your C# project via NuGet Package Manager, allowing you to leverage its powerful features for Excel file conversion. What are the advantages of using IronXL for file conversion? IronXL simplifies the conversion process by supporting multiple file formats and providing methods for advanced data handling like exporting to byte arrays or memory streams. Chaknith Bin Chat with engineering team now Software Engineer Chaknith works on IronXL and IronBarcode. He has deep expertise in C# and .NET, helping improve the software and support customers. His insights from user interactions contribute to better products, documentation, and overall experience. Ready to Get Started? Free NuGet Download Total downloads: 1,552,917 View Licenses