csv to excel

Convert CSV to Excel workbook using C# .NET.

Often, data is stored in CSV (Comma-Separated Values) format due to its simplicity and widespread compatibility across various platforms and applications. However, when it comes to in-depth analysis, reporting, and visualization, Excel workbooks offer a superior set of features and functionalities. Therefore, by converting CSV files to Excel workbooks using C# .NET, you can seamlessly transition your data into a format that lends advanced data manipulation, charting, and formatting options available within Excel.

API for CSV to Excel Conversion

GroupDocs.Conversion Cloud SDK for .NET offers robust support for various file formats, ensuring compatibility with a wide range of data sources. Through intuitive APIs and methods, you can effortlessly integrate CSV to Excel conversion functionality into your applications, with just a few lines of code. Moreover, GroupDocs.Conversion Cloud ensures high-fidelity conversion results, preserving data integrity, formatting, and structure throughout the process.

The first step is to install the SDK by searching GroupDocs.Conversion-Cloud in NuGet package manager and click the Install button. Another option is to execute the following command in package manager console.

NuGet\Install-Package GroupDocs.Conversion-Cloud -Version 24.4.0

Now we need to obtain our personalized API credentials(i.e. Client ID and Client Secret). Please follow the instructions specified in this short tutorial explaining the details on how to get the API credentials.

Comma Delimited File to Excel in C# .NET

In this section, we are going to explore a reliable and efficient solution for transforming CSV files into Excel workbooks using C# .NET.

  1. Create an instance of Configuration class where we pass client credentials as arguments.
var configurations = new Configuration(clientId, clientSecret1);
  1. Initialize the ConvertApi where we pass Configuration object as an input argument.
var apiInstance = new ConvertApi(configurations);
  1. Upload the input CSV file to the cloud storage.
fileUpload.UploadFile(new UploadFileRequest("input.csv", stream));
  1. Create an instance ConvertSettings where we specify the name for input CSV, resultant format as XLS and the name for resultant Excel workbook as arguments.
var settings = new ConvertSettings{...}
  1. Call the ConvertDocumentRequest API to convert CSV to Excel and save the resultant XLS to the cloud storage.
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings));
csv to excel

Image:- Comma separated file to Excel conversion preview.

The input CSV and the resultant Excel workbook generated in the above example can be downloaded from input.csv and resultant.xls.

Convert CSV to Excel using cURL commands

With GroupDocs.Conversion Cloud RESTful API endpoints, you may initiate conversions directly from the command line, making it convenient for batch processing and automation tasks. So, by simply constructing a cURL command with the appropriate parameters, you can specify the input CSV file, define the desired output format (Excel), and configure additional conversion options as needed.

The first step is to generate JWT access token based on client credentials and once we have generated the JWT token, please execute the following cURL command to convert CSV format to Excel workbook and save the resultant Excel worksheet in cloud storage.

curl -v "https://api.groupdocs.cloud/v2.0/conversion" \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}" \
-H "Content-Type: application/json" \
-d "{  \"StorageName\": \"internal\",  \"FilePath\": \"{sourceFile}\",  \"Format\": \"xls\",  \"LoadOptions\": {    \"Format\": \"csv\"  },\"OutputPath\": \"{resultantFile}\"}"

Please replace sourceFile with the name of input CSV file, resultantFile with the name of resultant Excel workbook and accessToken with personalized JWT access token.

  • Please try using the following cURL command if you desire to save the resultant Excel workbook on local drive.
curl -v "https://api.groupdocs.cloud/v2.0/conversion" \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}" \
-H "Content-Type: application/json" \
-d "{  \"StorageName\": \"internal\",  \"FilePath\": \"{sourceFile}\",  \"Format\": \"xls\",  \"LoadOptions\": {    \"Format\": \"csv\"  }}" \
-o "resultantFile.xls"

Download Webpage as Excel

You may also consider downloading the web page as Excel format using our free CSV Format to Excel Converter. This lightweight and super-efficient App is developed on top of GroupDocs.Conversion Cloud REST APIs and enables you to witness the amazing capabilities of our REST API.

csv to excel app


In conclusion, whether you choose to leverage GroupDocs.Conversion Cloud SDK for .NET or utilize cURL commands with GroupDocs.Conversion Cloud, converting CSV files to Excel workbooks has never been easier. With both approaches, you can enjoy seamless and efficient conversion processes while ensuring high-quality results.

We highly recommend visiting the following links to learn more about: