XLS or XLSX files are popularly used to perform several arithmetic operations. Information can be turned into data or visual graphs. In certain cases, you may need to convert an XLS or XLSX file to TXT format in order to archive data or maybe making the data compatible with different applications. In accordance with such scenarios, this article explains how to convert XLS/XLSX to TXT programmatically in Java.
XLS to TXT Conversion – Java API Installation
Aspose.Cells for Java can be used to work with different spreadsheet formats like XLS, XLSX, XLSM, etc. You can configure the API by adding the reference with its JAR files from the Downloads section or access it from the Aspose Repository with the following Maven specifications:
Repository:
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>https://repository.aspose.com/repo/</url>
</repository>
Dependency:
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-cells</artifactId>
<version>22.6</version>
</dependency>
Convert XLS to TXT in Java
You can convert an Excel file in XLS format to a TXT file in Java with the following steps:
Create a Workbook class object to load the source XLS file.
Write the output TXT file with the Save method.
The code sample below elaborates how to convert an XLS file to a TXT file programmatically in Java:
Get a Free License
You can request a free temporary license in order to evaluate the API without any limitations.
Conclusion
In this article, you have understood how to convert XLS to TXT file programmatically in Java. You can quickly perform this conversion with a few API calls without worrying about the file structure or other minor details about the file formats. Furthermore, please feel free to go through different chapters in the documentation section to explore other features offered by the API. If you have any query or doubts, you can freely discuss with us via the forum.