CSV (Comma Separated Values) files are widely used for storing tabular data in a simple, text-based format. Often, businesses need to convert Excel workbooks to CSV for reporting, importing into databases, or integrating with other applications. Using our .NET REST API, you can automate this conversion process, handling multiple Excel file types including XLS, XLSX, and XLSM.

Comma Delimited Files Processing API

Aspose.Cells Cloud SDK for .NET is REST based API offering an efficient solution for Excel Workbook processing. As per our requirements of converting Excel workbook to comma delimited files, it’s an ideal solution and with few lines of code, you can easily transform XLS to CSV format.

Set Up Aspose.Cells Cloud SDK for .NET

Install the SDK via NuGet Package Manager:

Install-Package Aspose.Cells-Cloud

Then initialize your API client using your Client ID and Client Secret from the Aspose Cloud Dashboard. For further details, please visit quick start article.

Excel to Comma Separated Values in C#

This section provides all the details on how we can programmatically change XLSX to CSV using C# .NET.

Step 1: - Create an Instance of CellsApi using client credentials.

CellsApi api = new CellsApi(clientId,clientSecret);

Step 2: Upload the Excel File to Cloud Storage

UploadFileRequest request = new UploadFileRequest("input.xls", "source.xls", null);
cellsInstance.UploadFile(request);

Step 3: Create an instance of SaveOptions and define CSV format.

SaveOptions saveOptions = new SaveOptions();
saveOptions.SaveFormat = "CSV";

Step 4: Save Excel as CSV (Comma Delimited) using PostWorkbookSaveAs(…).

var response = cellsInstance.PostWorkbookSaveAs(convert);
  • This will generate a CSV file that retains your data structure in comma-separated values format.

Convert XLSX into CSV using cURL

If you prefer direct REST API usage, you can also perform Excel to CSV conversion using a simple cURL command.

Step 1: Obtain Access Token

curl -v "https://api.aspose.cloud/connect/token" \
 -X POST \
 -d "grant_type=client_credentials&client_id=XXXXXXX-b195-426c-85f7-XXXXXXXX&client_secret=XXXXXXXXXXXXXXXXXXXXXXXXX" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Accept: application/json"
  • The response will include an ACCESS_TOKEN which you’ll use for authorization.

Step 2: Convert Excel File to CSV (Comma-Delimited) Use the following cURL command to convert your Excel workbook (Sample.xlsx) to CSV format:

curl -X 'POST' \
  'https://api.aspose.cloud/v3.0/cells/{sourceFile}/SaveAs?newfilename={myResultant}&isAutoFitRows=false&isAutoFitColumns=false&storageName=internal&checkExcelRestriction=false' \
  -H 'accept: application/json' \
  -H 'authorization: Bearer {ACCESS_TOKEN}' \
  -H 'Content-Type: application/json' \
  -d '{
  "SaveFormat": "csv",
  "CheckExcelRestriction": true
}'

Explanation:

  • PUT /cells/convert?format=CSV — specifies the output format as CSV.
  • file=@/path/to/Sample.xlsx — provides the local Excel file to be uploaded.
  • The -d parameter saves the output as a comma-separated .csv file.
  • Once executed, the converted CSV file will be stored in cloud storage.

Free XLS to CSV Converter

If you want to explore the capabilities of Aspose.Cells Cloud API without any code snippet or without using the cURL commands, try using our free online Excel to CSV Converter.

excel to csv converter

Conclusion

We have learned that Aspose.Cells Cloud REST API enables you to easily convert Excel files to CSV comma-separated values in multiple ways, i.e. .NET applications or while using the cURL command.

Advantages of using REST API

  • Cloud-based Automation: Convert XLS, XLSX, or XLSM to CSV online via REST.
  • Secure: Your data is processed through authenticated API calls.
  • Flexible Integration: Works with .NET, Java, Python, Node.js, PHP, and more.
  • No Excel Installation Needed: 100% cloud-based processing.

Please visit the following links to learn more about:

Frequently Asked Questions (FAQs)

  1. Can I convert Excel files to CSV without installing Microsoft Excel?
  • Yes. With Aspose.Cells Cloud, you can convert Excel to CSV (comma-separated values) entirely in the cloud. The conversion happens via REST API, so there’s no need to install Microsoft Excel or any other desktop software.
  1. Is it possible to convert password-protected Excel workbooks to CSV?
  • Yes. If your Excel workbook is protected, you can specify the password parameter in the API request. Aspose.Cells Cloud will decrypt the file during conversion and then export the data to CSV format securely.
  1. Does the Excel to CSV conversion support multiple worksheets?
  • By default, Aspose.Cells Cloud converts the first worksheet to CSV format. However, you can customize your request to select a specific worksheet or export each sheet individually into separate CSV files.
  1. Can I perform bulk Excel to CSV conversions using the .NET REST API?
  • Yes. You can automate batch Excel to CSV conversions by iterating over multiple files in your storage and calling the conversion endpoint programmatically through the Aspose.Cells Cloud SDK for .NET.