excel to csv

How to convert Excel to comma separated values online with .NET Cloud SDK.

The ability to seamlessly convert Excel files to CSV format stands as a pivotal skill for developers and data enthusiasts alike. We understand that Excel sheets are powerful tool for data organization, but sometimes we poses challenges when it comes to interchangeability and compatibility with various systems. Therefore, this guide explores the imperative need for this transformation, delving into the nuances of data interchangeability, with ease of integration. Let’s delve into the details of using .NET REST API that empowers you to navigate and optimize the data workflows efficiently.

Excel to CSV Conversion SDK

Aspose.Cells Cloud SDK for .NET opens up a realm of possibilities when seeking a robust and efficient solution for Excel to CSV conversion. This SDK supports various Excel formats, ensuring flexibility in handling diverse data structures. Therefore, by harnessing the power of Aspose.Cells Cloud SDK in C# .NET, you can effortlessly convert complex Excel files to CSV, preserving data integrity and formatting.

In order to use the SDK in application, first we need to search Aspose.Cells-Cloud in NuGet packages manager and click the Add Package button. Secondly, obtain your client credentials from cloud dashboard. If you do not have an existing account, simply create a free account by following the instructions specified in the quick start article.

Convert XLSX to CSV in C# .NET

The Cloud SDK’s provides the ability to perform conversions in the cloud adding a layer of scalability and accessibility, eliminating the need for local installations. Let’s explore the details on how to convert an XLSX to CSV using C# .NET.

CellsApi cellsInstance = new CellsApi(clientID, clientSecret);

Create an object of CellsApi class where we pass client credentials as arguments.

 cellsInstance.UploadFile("input.xls", inputFile);

We need to read the content of input Excel and then upload it to the cloud storage.

var response = cellsInstance.CellsWorkbookGetWorkbook("input.xls", null, format: "CSV", isAutoFit: true, null, null, null, "output.html", null);

Now, call the API to perform the Excel to CSV conversion online. After successful operation, the resultant CSV is also uploaded to the cloud storage.

excel to csv preview

A preview of Excel to CSV conversion using .NET REST API.

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

Excel to Comma Delimited Files using cURL Commands

We have learned that Aspose.Cells Cloud provides a comprehensive API for Excel manipulation in the cloud, and the cURL commands offer a convenient way to interact with this API. So, the conversion of Excel to comma-delimited files (CSV) using Aspose.Cells Cloud in conjunction with cURL commands is a powerful and versatile approach. Therefore, the combination of Aspose.Cells Cloud and cURL commands provides a seamless and efficient solution for developers looking to perform Excel to CSV conversions in a flexible and scalable manner.

The first step in this approach is to generate a JWT access token using the following command:

curl -v "https://api.aspose.cloud/connect/token" \
 -X POST \
 -d "grant_type=client_credentials&client_id=921363a8-b195-426c-85f7-7d458b112383&client_secret=2bf81fca2f3ca1790e405c904b94d233" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Accept: application/json"

Once we have the JWT token, please execute the following command to convert Excel to CSV online. The input Excel shall be already available in the cloud storage and after conversion, the resultant CSV will be stored in same cloud storage (unless you specify different location).

curl -v "https://api.aspose.cloud/v3.0/cells/{sourceFile}?format=CSV&isAutoFit=true&onlySaveTable=true&outPath={Resultant}&checkExcelRestriction=true" \
-X GET \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}"

Replace sourceFile with the name of input Excel workbook available in cloud storage, Resultant with the name of output CSV to be generated and accessToken with a JWT access token generated above.

  • In order to save the resultant CSV on local drive, please use the following cURL command where we have skipped the output file name in the GET request and have used -o argument, specifying the resultant file path.
curl -v "https://api.aspose.cloud/v3.0/cells/input.xls?format=CSV&isAutoFit=true&onlySaveTable=true&checkExcelRestriction=true" \
-X GET \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}" \
-o "resultant.csv"

Conclusion

In conclusion, this comprehensive guide has shed light on two powerful approaches for Excel to CSV conversion, each catering to the diverse needs of developers. Whether harnessing the capabilities of C# .NET or leveraging the Aspose.Cells Cloud with cURL commands, we streamline and enhance the efficiency of Excel data transformations. Whichever path chosen, you are equipped with the insights needed to elevate your data processing workflows and seamlessly convert Excel files to CSV with confidence.

We highly recommend visiting the following blogs: