Convert CSV to XLS in C#
Native and high performance CSV to XLS conversion using server side GroupDocs.Conversion for .NET APIs, without the use of any software like Microsoft or Open Office.
Download Free Trial
GroupDocs.Conversionfor .NET
About GroupDocs.Conversion for .NET API
GroupDocs.Conversion API can be used to convert Microsoft Word, Excel, PowerPoint, PDF, Visio and various other formats. GroupDocs.Conversion is a standalone API that is suitable for server side and backend systems where high performance is required. It does not depend on any software like Microsoft or Open Office.
Steps to Convert CSV to XLS in C#
GroupDocs.Conversion makes it easy for developers to convert the CSV file to XLS using a few lines of code.
- Create an instance of Converter class and load the CSV file with full path
- Create & set ConvertOptions for the xls type
- Call Converter.Convert method and pass the full path and format (XLS) as parameter
System Requirements
A basic conversion with GroupDocs.Conversion for .NET APIs can be done by implementing a few easy steps. Our APIs are supported on all major platforms and operating systems. Before executing the code below, please make sure that you have the following prerequisites installed on your system.
- Operating Systems: Microsoft Windows, Linux, MacOS
- Development Environments: Microsoft Visual Studio, Xamarin, MonoDevelop
- Frameworks: .NET Framework, .NET Standard, .NET Core, Mono
- Get the latest version of GroupDocs.Conversion for .NET downloaded from Nuget
C# code snippet to convert CSV to XLS
// load the CSV file
var converter = new GroupDocs.Conversion.Converter("template.csv");
// set the convert options for XLS format
var convertOptions = converter.GetPossibleConversions()["xls"].ConvertOptions;
// convert to XLS format
converter.Convert("output.xls", convertOptions);
CSV to XLS Live Demos
Convert CSV to XLS right now by visiting GroupDocs.Conversion Live Demos website.
The live demo has the following benefits
CSV About CSV File Format
Files with CSV (Comma Separated Values) extension represent plain text files that contain records of data with comma separated values. Each line in a CSV file is a new record from the set of records contained in the file. Such files are generated when data transfer is intended from one storage system to another. Since all applications can recognize records separated by comma, import of such data files to database is done very conveniently. Almost all spreadsheet applications such as Microsoft Excel or OpenOffice Calc can import CSV without much effort. Data imported from such files is arranged in cells of a spreadsheet for representation to user.
Read MoreXLS About XLS File Format
Files with XLS extension represent Excel Binary File Format. Such files can be created by Microsoft Excel as well as other similar spreadsheet programs such as OpenOffice Calc or Apple Numbers. File saved by Excel is known as Workbook where each workbook can have one or more worksheets. Data is stored and displayed to users in table format in worksheet and can span numeric values, text data, formulas, external data connections, images, and charts. Applications like Microsoft Excel lets you export workbook data to several different formats including PDF, CSV, XLSX, TXT, HTML, XPS, and several others. The XLS file format was replaced with a more open and structured format, XLSX, with the release of Microsoft Excel 2007. The latest versions still provide support for creating and reading XLS files, though XLSX is the first choice of use now.
Read MoreOther Supported Conversions
You can also convert CSV into many other file formats. Please see the complete list below.