- Java API to convert XLS to TXT
- Convert a XLS file to TXT in Java
- Code example in Java using REST API to convert XLS to TXT format
- How to use Java API to convert XLS to TXT
- Convert XLS to TXT in Java
- XLS to TXT conversion with a few lines of Java code
- GroupDocs.Conversion
- About GroupDocs.Conversion for Java API
- Steps to Convert XLS to TXT in Java
- System Requirements
- XLS to TXT Live Demo
- Other supported XLS conversions in Java
- Convert XLS/XLSX to TXT in Java
- XLS to TXT Conversion – Java API Installation#
- Convert XLS to TXT in Java#
- Get a Free License#
- Conclusion#
- See Also#
- Convert XLS to TXT via Java
- XLS to TXT Java conversion to convert single or multiple pages to TXT using On-premise Java library.
- Aspose.Cells for Java
- Overview
- Convert XLS to TXT Using Java
- Repository
- Dependency
- Convert XLS to TXT via java
- Use free app or Java SDK to convert between XLS & TXT as well as several popular formats from Microsoft ® Excel.
- XLS to TXT Conversion in Cloud Apps
- Get Started with Aspose.Total REST APIs
- Convert Excel XLS Documents
- Excel to Image conversion
- FAQ
Java API to convert XLS to TXT
Use Cells Conversion REST API to create customized spreadsheet workflows in Java. This is a professional solution to convert XLS to TXT and other document formats online using Java.
Convert a XLS file to TXT in Java
Converting file formats from XLS to TXT is a complex task. All XLS to TXT format transitions is performed by our Java SDK while maintaining the source XLS spreadsheet’s main structural and logical content. Our Java library is a professional solution to convert XLS to TXT files online. This Cloud SDK gives Java developers powerful functionality and perfect TXT output.
Code example in Java using REST API to convert XLS to TXT format
// For complete examples and data files, please go to https://github.com/aspose-cells-cloud/aspose-cells-cloud-java/ import java.io.File; import com.aspose.cloud.cells.api.*; public class Conversion public static void main(String[] args) String name = "Book1.xls"; String format = "txt"; String password = null; String outPath = null; String destFile = "DestFile.txt"; try CellsApi cellsApi = new CellsApi(System.getenv("ProductClientId"), System.getenv("ProductClientSecret")); File response = cellsApi.cellsWorkbookPutConvertWorkbook(new File(name), format, password, outPath, null,null); if(response.canRead()) if(response.exists()) response.renameTo(new File(destFile)); > > > catch(Exception exception ) System.out.print(exception); > > >
How to use Java API to convert XLS to TXT
- Create an account at Dashboard to get free API quota & authorization details
- Initialize CellsApi with Client Id, Client Secret, Base URL & API version
- Call cellsWorkbookPutConvertWorkbook method to get the resultant stream
Convert XLS to TXT in Java
XLS to TXT conversion with a few lines of Java code
GroupDocs.Conversion
About GroupDocs.Conversion for Java API
GroupDocs.Conversion for Java is an advanced file format conversion API for converting between popular image and document formats such as Microsoft Office, OpenDocument, PDF, HTML, email, CAD. and much more with just a few lines of code. The native API automatically detects the formats of the original documents and offers many options for customizing the converted documents. Along with the function of extracting information from a document, it also supports caching of the conversion results to the local disk by default. However, any type of cache storage can be supported by implementing the appropriate interfaces — Amazon S3, Dropbox, Google Drive, Windows Azure, Reddis, or any others.
Convert your XLS files to TXT files in Java. It only takes a couple of lines of Java code on any platform of your choice, such as Windows, Linux, macOS. You can try converting XLS to TXT for free and evaluate the quality of the conversion results. Along with simple file conversion scripts, you can try more sophisticated options for loading the XLS source file and storing the TXT output.
For example, for the source file XLS, you can use the following upload options:
- automatic detection of the file format;
- specify a password for protected files (if the file format supports it);
- replace missing fonts to preserve the appearance of the document.
There are also advanced conversion options for the TXT file:
- convert a specific page of a document or a range of pages;
- add a watermark to the converted TXT.
Once the conversion is complete, you can save the TXT file to your local file path or to any third party storage such as FTP, Amazon S3, Google Drive, Dropbox etc. Please note — to convert XLS to TXT, you do not need to install any additional software, such as MS Office, Open Office, Adobe Acrobat Reader etc.
Steps to Convert XLS to TXT in Java
GroupDocs.Conversion allows developers to easily convert a XLS file to TXT with a few lines of code.
- Create a new instance of the Converter class and upload the file XLS with the full path
- Set ConvertOptions for document type to TXT.
- Call the convert() method and pass the document name (full path) and format (TXT) as a parameter
System Requirements
Basic conversion using GroupDocs.Conversion for the Java API can be done with just a few lines of code. Our APIs are supported on all major platforms and operating systems. Before executing the code below, make sure you have the following prerequisites installed on your system.
- Operating systems: Microsoft Windows, Linux, MacOS
- Development environment: NetBeans, Intellij IDEA, Eclipse, etc.
- Java runtime: J2SE 6.0 and above
- Get the latest GroupDocs.Conversion for Java from Maven
// Load source file XLS for conversion Converter converter = new Converter("input.xls"); // Prepare conversion options for target format TXT ConvertOptions convertOptions = new FileType().fromExtension("txt").getConvertOptions(); // Convert to TXT format converter.convert("output.txt", convertOptions);
XLS to TXT Live Demo
Convert XLS to TXT now by visiting the GroupDocs.Conversion App website. The free demo has the following benefits
No need to write any code
Just upload the source file
Get download link to save the file
Other supported XLS conversions in Java
You can also convert XLS to many other file formats. Please see the list below.
(OpenDocument Flat XML Spreadsheet)
(Hypertext Markup Language File)
(Hyper Text Markup Language)
(JavaScript Object Notation File)
(StarOffice Calc Spreadsheet)
(Microsoft Excel Spreadsheet (Legacy))
(Excel Macro-Enabled Template)
Convert XLS/XLSX to TXT in Java
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:
AsposeJavaAPI Aspose Java API https://repository.aspose.com/repo/
com.aspose aspose-cells 22.6
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.
See Also#
Convert XLS to TXT via Java
XLS to TXT Java conversion to convert single or multiple pages to TXT using On-premise Java library.
Aspose.Cells for Java
Overview
Download from Maven
You can easily use Aspose.Cells for Java directly from a Maven based project by following simple installation instructions.
Convert XLS to TXT Using Java
How to convert XLS to TXT? With Aspose.Cells for Java library, you can easily convert XLS to TXT programmatically with a few lines of code. Aspose.Cells for Java is capable of building cross-platform applications with the ability to generate, modify, convert, render and print all Excel files. Java Excel API not only convert between spreadsheet formats, it can also render Excel files as images, PDF, HTML, ODS, CSV, SVG, JSON, WORD, PPT and more, thus making it a perfect choice to exchange documents in industry-standard formats. You can download its latest version directly from Maven and install it within your Maven-based project by adding the following configurations to the pom.xml.
Repository
AsposeJavaAPI Aspose Java API https://repository.aspose.com/repo/
Dependency
com.aspose aspose-cells version of aspose-cells API jdk17
Convert XLS to TXT via java
Use free app or Java SDK to convert between XLS & TXT as well as several popular formats from Microsoft ® Excel.
// Converting XLS to HTML SaveOptions saveOptions = new SaveOption(); saveOption.setSaveFormat("XLS"); SaveResponse response = cellsApi.cellsSaveAsPostDocumentSaveAs(file, saveOptions, newfilename + ".HTML", isAutoFitRows, isAutoFitColumns, folder,null); // Converting HTML to TXT HtmlSaveOptionsData requestSaveOptionsData = new HtmlSaveOptionsData(); requestSaveOptionsData.setFileName("/file.HTML"); SaveAsRequest request = new SaveAsRequest("file.TXT",requestSaveOptionsData,remoteFolder,null,null,null,null,null); SaveResponse result = wordsApi.saveAs(request);
XLS to TXT Conversion in Cloud Apps
- Initialize WordsApi and CellsApi with Client Id, Client Secret, Base URL & API version
- Set ConvertDocumentRequest with parameters local file name and format as HTML
- Call WordsApi convertDocument to convert XLS document to HTML
- Initialize SaveOption from CellsAPI with parameters SaveFormat as TXT
- Call cellsSaveAsPostDocumentSaveAs method to convert XLS file to TXT
Get Started with Aspose.Total REST APIs
- Create an account at Dashboard to get free API quota & authorization details
- Get Aspose.Words and Aspose.Cells Cloud SDKs for Java source code from Aspose.Words GitHub and Aspose.Cells GitHub repos to compile/use the SDK yourself or head to the Releases for alternative download options.
- Also have a look at Swagger-based API Reference for Aspose.Words and Aspose.Cells to know more about the REST API.
Convert Excel XLS Documents
Convert XLS to HTML using Aspose.Cells then feed the HTML to any of the Aspose.Total APIs like Aspose.Words, Aspose.PDF, Aspose.Email, Aspose.Slides, Aspose.Diagram, Aspose.Tasks, Aspose.3D, Aspose.HTML to export the result in 100+ popular file formats.
For all the supported formats please visit Aspose.Total Cloud page
Excel to Image conversion
Aspose.Cells Cloud SDK produces few quick and easy ways to convert MS Excel files to various image formats similar to what we have done above for TXT: by direct REST API calls or using SDKs. There are multiple image formats accessible for converting Excel sheets with Aspose.Cells Cloud APIs — JPEG, PNG, BMP, GIF, and TIFF.
- Create SaveOption object and set desire format using SaveFormat property.
- Create ConvertDocumentRequest object to convert XLS document
- Call SaveAsPostDocument method of CellsApi class instance for conversion from XLS
FAQ
Files with XLS extension represent Excel Binary File Format. Such files can be created by Microsoft Excel as well as other similar spreadsheet programs such as OpenOffice Calc or Apple Numbers. File saved by Excel is known as Workbook where each workbook can have one or more worksheets. Data is stored and displayed to users in table format in worksheet and can span numeric values, text data, formulas, external data connections, images, and charts. Applications like Microsoft Excel lets you export workbook data to several different formats including PDF, CSV, XLSX, TXT, HTML, XPS, and several others. The XLS file format was replaced with a more open and structured format, XLSX, with the release of Microsoft Excel 2007. The latest versions still provide support for creating and reading XLS files, though XLSX is the first choice of use now.
A file with .TXT extension represents a text document that contains plain text in the form of lines. Paragraphs in a text document are recognized by carriage returns and are used for better arrangement of file contents. A standard text document can be opened in any text editor or word processing application on different operating systems. All the text contained in such a file is in human-readable format and represented by sequence of characters.
Quickstart not only guides through the initialization of Aspose.Total Cloud API, it also helps in installing the required libraries.
Of course! Aspose Cloud uses Amazon EC2 cloud servers that guarantee the security and resilience of the service. Please read more about Aspose’s Security Practices.
Aspose.Total Cloud can convert file formats from any product family to any other product family to PDF, DOCX, XPS, image(TIFF, JPEG, PNG BMP), MD and more. Checkout the complete list of supported file formats.
Aspose.Total Cloud is also available as a Docker Container. Try using it with cURL in case your required SDK is not available yet.