TSV to Excel

How to perform TSV to Excel conversion in Java

Tab-Separated Values (TSV) files are widely used for storing plain text data in a structured format, making them ideal for data interchange between different applications. However, their simplicity can become a limitation when it comes to advanced data analysis, formatting, and visualization. Therefore, by converting TSV files to Excel (XLS) format unlocks a range of benefits, including the ability to apply formulas, create charts, and organize data in a more visually appealing and user-friendly manner.

API for Excel Workbook Manipulation

Aspose.Cells Cloud SDK for Java provides a seamless and efficient way to convert TSV files to XLS format. The SDK simplifies the entire process by offering intuitive methods that handle the conversion with minimal code. With support for various file formats, including TSV and Excel, Aspose.Cells Cloud ensures high accuracy in data transformation while preserving the structure and integrity of the original dataset.

Installation

Please add the following details to pom.xml file of maven build project.

<repositories>
    <repository>
        <id>AsposeJavaAPI</id>
        <name>Aspose Java API</name>
        <url>https://repository.aspose.cloud/repo/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>com.aspose</groupId>
        <artifactId>aspose-cells-cloud</artifactId>
        <version>24.9</version>
    </dependency>
</dependencies>

Now, we need to obtain our client credentials from cloud dashboard. If you do not have an existing account, simply create a free account by following the instructions specified in the quick start article.

Convert TSV to XLS in Java

In this section, we are going to explore the details on how we can perform business intelligence, data reporting, or enhanced analysis, by transforming the TSV to XLS format using Java code snippet.

CellsApi api = new CellsApi(clientId,clientSecret);

Create an instance of CellsApi while providing client credentials as input arguments.

api.uploadFile("input.tsv", file, "internal");

Upload the source TSV to the cloud storage using uploadFile(…) method.

File response = api.cellsWorkbookGetWorkbook(name, null ,format, 
                        null, null, null, "internal", "myResultant.xls", "internal", null);

Finally, call the method cellsWorkbookGetWorkbook(…) to initiate the conversion operation.

tsv to xls conversion

A preview of TSV to XLS conversion.

The input TSV and the resultant Excel generated in the above example can be downloaded from input.tsv and myResultant.xls.

TSV to XLSX using cURL Commands

Aspose.Cells Cloud provides a straightforward way to convert TSV files to Excel format using cURL commands. This approach is particularly beneficial for developers who prefer a lightweight, scriptable solution without the need for additional libraries or complex setups.

The first step in this approach is to generate a JWT access token using the following command:

curl -v "https://api.aspose.cloud/connect/token" \
 -X POST \
 -d "grant_type=client_credentials&client_id=XXXXXXX-b195-426c-85f7-XXXXXXXX&client_secret=XXXXXXXXXXXXXXXXXXXXXXXXX" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Accept: application/json"

Now, in order to perform the TSV to XLSX conversion, please execute the following command:

curl -v "https://api.aspose.cloud/v3.0/cells/{sourceFile}?format=xlsx&isAutoFit=false&onlySaveTable=false&outPath={resultantFile}" \
-X GET \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}"

Simply replace sourceFile with the name of input TSV file (already available in the cloud storage), resultantFile with the name of resultant Excel workbook and accessToken with JWT access token generated above.

In case you need to save the resultant XLSX workbook to a local drive, please use the following cURL command:

curl -v "https://api.aspose.cloud/v3.0/cells/input.tsv?format=xlsx&isAutoFit=false&onlySaveTable=false" \
-X GET \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}" \
-o "MyConverted.xlsx"

Free TSV to XLSX Converter

You may consider using our lightweight and supper-efficient TSV to XLSX Conversion App. This free App is built on top of Aspose.Cells Cloud APIs and can be tested online without any installation.

C# TSV conversion

Free TSV to XLSX conversion App

Conclusion

We have learned that Aspose.Cells Cloud offers a powerful, flexible, and easy-to-implement solution for this task, whether you prefer using the comprehensive Java SDK or lightweight cURL commands. Take control of your data transformation needs and experience the reliability of Aspose.Cells Cloud APIs. Start your free trial today and discover how effortlessly you can handle TSV-to-Excel conversions!

We highly recommend you to visit the following links and learn more about: