How to Convert XLSX to CSV using C# in .NET Framework

Install-Package Cloudmersive.APIClient.NET.DocumentAndDataConvert -Version 1.3.4
using System;
using System.Diagnostics;
using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Api;
using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Client;
using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Model;
namespace Example
{
public class ConvertDocumentXlsxToCsvExample
{
public void main()
{
// Configure API key authorization: Apikey
Configuration.Default.AddApiKey("Apikey", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.AddApiKeyPrefix("Apikey", "Bearer");
var apiInstance = new ConvertDocumentApi();
var inputFile = new System.IO.Stream(); // System.IO.Stream | Input file to perform the operation on.
try
{
// Excel XLSX to CSV
byte[] result = apiInstance.ConvertDocumentXlsxToCsv(inputFile);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling ConvertDocumentApi.ConvertDocumentXlsxToCsv: " + e.Message );
}
}
}
}
using System;
using System.Diagnostics;
using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Api;
using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Client;
using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Model;
namespace Example
{
public class ConvertDocumentXlsxToCsvMultiExample
{
public void main()
{
// Configure API key authorization: Apikey
Configuration.Default.AddApiKey("Apikey", "YOUR_API_KEY");
var apiInstance = new ConvertDocumentApi();
var inputFile = new System.IO.FileStream("C:\\temp\\inputfile", System.IO.FileMode.Open); // System.IO.Stream | Input file to perform the operation on.
var outputEncoding = outputEncoding_example; // string | Optional, set the output text encoding for the result; possible values are UTF-8, ASCII and UTF-32. Default is UTF-8. (optional)
try
{
// Convert Excel XLSX Spreadsheet to CSV, Multiple Worksheets
CsvCollection result = apiInstance.ConvertDocumentXlsxToCsvMulti(inputFile, outputEncoding);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling ConvertDocumentApi.ConvertDocumentXlsxToCsvMulti: " + e.Message );
}
}
}
}

--

--

--

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Basics of R

Integrating SonarQube with Springboot — Gradle

Port Location Optimization in Oil and Gas Business

Continuous Integration, Continuous Deployment Rails App with Bitbucket Pipeline + Capistrano

3-month plan for Cracking the Coding Interview

Study Plan For Coding Interview

Introductory Blog

AI Powered Engineering Management

Indexing In DBMS

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

More from Medium

Convert Excel XLSX Files to XML Files in C#

Enumerating active directory using C#

How to convert DateTime objects to Python-friendly ISO8601 strings in C#

How to perform data-binding in Blazor