TXT files are commonly used to work with plain data with little or no formatting. Sometimes numeric data exists as a TXT file which you might need to convert to an XLSX Excel file for further processing. In this article, you will learn how to convert a TXT file to XLSX format programmatically in Java.
TXT to XLSX Converter - Java API Configuration
Aspose.Cells for Java is a feature-rich API to work with Microsoft Excel-associated worksheets within the Java applications. You can quickly configure the API by downloading the reference JAR files from the downloads section or from the repository with the following Maven configurations:
<repository> <id>AsposeJavaAPI</id> <name>Aspose Java API</name> <url>https://repository.aspose.com/repo/</url> </repository>
<dependency> <groupId>com.aspose</groupId> <artifactId>aspose-cells</artifactId> <version>22.6</version> </dependency>
Convert TXT to XLSX Excel File in Java
You need to follow the steps below in order to convert a TXT file to XLSX format using Java.
- Initialize a TxtLoadOptions class object.
- Create a new Workbook object.
- Save the XLSX file while specifying the output file name.
The code snippet below shows how to convert a TXT file to XLSX Excel format programmatically in Java:
Get a Free License
You can request a free temporary license to evaluate the API without any evaluation restrictions.
In this article, you have explored how to convert TXT to XLSX format programmatically in Java. This conversion can help you to perform several arithmetic operations as well as create charts based on the numeric data in the source TXT file. Furthermore, you may visit the API documentation to explore many other features of the API for working with different Excel files. Please feel free to reach out to us at the forum in case you want to discuss any of your concerns or queries.