Excel spreadsheets are widely used for organizing, analyzing, and presenting structured data. However, there are many scenarios where extracting and sharing this data in a simple, text-based format becomes essential—such as for integration, data migration, or lightweight reporting. In this article, we are going to explore the details on transforming Excel workbooks (XLS or XLSX) into plain text files, so that you can easily access, process, and utilize the data across diverse platforms and applications.
REST API for Excel Conversion
GroupDocs.Conversion Cloud SDK for .NET offers a comprehensive and reliable solution for Excel workbook conversion to variety of other supported formats. This SDK delivers high-quality conversion results, accurately preserving the structure, content, and formatting of the original Excel workbooks.
In order to use the SDK, we need to install the SDK by searching GroupDocs.Conversion-Cloud in NuGet package manager and click the Install button. Or, execute the following command in package manager console.
NuGet\Install-Package GroupDocs.Conversion-Cloud -Version 24.2.0
Another important step is to obtain your personalized API credentials(i.e. Client ID and Client Secret) from Cloud dashboard.
- For more information on how to obtain client credentials, please explore this tutorial.
Convert Excel to TXT in C#
Please follow the instructions specified below for an easy and simple Excel to TXT file conversion using C# .NET code snippet.
Step 1. - Create instance of Configuration
and ConvertApi
classes.
var configurations = new Configuration(clientId, clientSecret1);
var apiInstance = new ConvertApi(configurations);
Step 2. - Upload the input Excel workbook to the cloud storage.
fileUpload.UploadFile(new UploadFileRequest("input.xls", stream));
Step 3. - Create an object of ConvertSettings
class while specifying input XLS, resultant format as txt
and the name for resultant file.
var settings = new ConvertSettings{...}
Step 4. - Lastly, call the ConvertDocumentRequest API to transform Excel to TXT format.
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings));
XLSX to TXT using cURL Commands
If you are looking for a simple and scriptable method to convert Excel workbooks to text files, the REST API in combination with cURL commands provides an efficient solution. Therefore, using cURL, you can initiate the conversion directly from the command line or within automation scripts, eliminating the need for programming or SDK integration.
Firstly, generate JWT_Access token based on client credentials. Once we have the token, please execute the following command to export XLSX to TXT format.
curl -v "https://api.groupdocs.cloud/v2.0/conversion" \
-X POST \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}" \
-H "Content-Type: application/json" \
-d "{ \"StorageName\": \"internal\", \"FilePath\": \"{sourceFile}\", \"Format\": \"txt\", \"ConvertOptions\": { \"FromPage\": 1, \"PagesCount\": 1, \"Pages\": [ 1 ] }, \"OutputPath\": \"{myOutput}\"}"
Replace:
sourceFile
with input Excel workbook.myOutput
with resultant TXT fileaccessToken
with personalized token generated above.
Save resultant TXT on local drive
In order to save the resultant TXT on local drive, please try executing the following cURL command.
curl -v "https://api.groupdocs.cloud/v2.0/conversion" \
-X POST \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}" \
-H "Content-Type: application/json" \
-d "{ \"StorageName\": \"internal\", \"FilePath\": \"input.xls\", \"Format\": \"html\", \"ConvertOptions\": { \"FromPage\": 1, \"PagesCount\": 1, \"Pages\": [ 1 ] }}" \
-o "resultant.txt"
- The
-o
parameter specifies to save the resultant TXT file on local drive.
Online Excel to TXT Converter
To quickly explore the capabilities of GroupDocs.Conversion Cloud, you can try our free online XLSX to TXT Converter App. This web-based tool provides a lightweight and efficient solution for converting Excel workbooks to text file format.

Reading Material
Conclusion
In conclusion, converting Excel workbooks (XLS/XLSX) to text files (TXT) enhances data accessibility, simplifies content extraction, and supports seamless integration with other applications and workflows. Whether you utilize the .NET Cloud SDK or execute cURL commands, both approaches provide reliable, efficient, and accurate solutions for Excel to Text conversion.
Related Articles
We highly recommend visiting the following links to learn more about: