Excel XLSX files are commonly used to store the data in the form of rows and columns. However, while processing the data, you often need to convert Excel files to CSV (Comma Separated Values) format. To perform this conversion programmatically, this article shows how to convert an Excel XLSX to CSV in Java.
- Java API for XLSX to CSV Conversion
- How to Convert XLSX to CSV Using Java
- Convert an XLSX to CSV in Java
High-Speed Java API to Convert XLSX to CSV - Free Download
To convert Excel XLSX files to CSV, we will use Aspose.Cells for Java. It is an amazing API that provides a bunch of features for creating and processing spreadsheet documents. Furthermore, it offers a high-fidelity conversion of spreadsheet files to other formats. You can download its JAR or install it directly using the following Maven configurations.
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>
How to Convert XLSX to CSV Using Java
To convert an Excel file to CSV, you only need to load the XLSX file and save it in CSV format. The following are the steps that you have to follow for XLSX to CSV conversion using Aspose.Cells for Java.
- Load the XLSX file by providing its file path.
- Save XLSX as CSV by providing output file’s path.
And that’s it.
Convert XLSX to CSV in Java
The following steps demonstrate how to convert an XLSX file to CSV in Java.
- Load the XLSX file using Workbook class.
- Save XLSX as CSV using Workbook.save() method.
The following code sample shows how to save an XLSX as CSV in Java.
import com.aspose.cells.Workbook; | |
// Load XLSX file | |
Workbook workbook = new Workbook("input.xlsx"); | |
// Save XLSX as CSV | |
workbook.save("Output.csv"); |
Java XLSX to CSV Converter - Get a Free License
You can get a free temporary license to use Aspose.Cells for Java without evaluation limitations.
Conclusion
In this article, you have learned how to convert XLSX files to CSV programmatically in Java. The code sample has demonstrated how you can integrate XLSX to CSV conversion in your Java applications. In addition, you can visit the documentation to explore other features of Aspose.Cells for Java. Also, you can share your questions or queries with us via our forum.