Java Excel API

Last updated

Java Excel API
Developer(s) Andy Khan, Eric H. Jung
Stable release
2.6.12 / 8 October 2012
Written in Java
Operating system Cross-platform
Type API to access Microsoft Excel format
License GNU LGPL v2.1+ [1]
Website jexcelapi.sourceforge.net

Java Excel API (a.k.a. JXL API) allows users to read, write, create, and modify sheets in an Excel (.xls) workbook at runtime. It doesn't support .xlsx format. [2]

Contents

Microsoft Excel support

Java Excel API supports Excel documents with versions Excel 95, 97, 2000, XP, and 2003. These documents hold the extension .xls. [2]

Usage

Java Excel API is widely used with Selenium.

Example

Sample code to write to an Excel file might look like as follows:

importjava.io.File;importjxl.Workbook;importjxl.write.WritableSheet;importjxl.write.WritableWorkbook;importjxl.write.Label;importjxl.write.WriteException;publicclassDataSheet{privateWorkbookwbook;privateWritableWorkbookwwbCopy;privateWritableSheetshSheet;publicvoidreadExcel(){try{wbook=Workbook.getWorkbook(newFile("path/testSampleData.xls"));wwbCopy=Workbook.createWorkbook(newFile("path/testSampleDataCopy.xls"),wbook);shSheet=wwbCopy.getSheet(0);}catch(Exceptione){e.printStackTrace();}}publicvoidsetValueIntoCell(StringstrSheetName,intiColumnNumber,intiRowNumber,StringstrData)throwsWriteException{WritableSheetwshTemp=wwbCopy.getSheet(strSheetName);LabellabTemp=newLabel(iColumnNumber,iRowNumber,strData);try{wshTemp.addCell(labTemp);}catch(Exceptione){e.printStackTrace();}}publicvoidcloseFile(){try{// Closing the writable work bookwwbCopy.write();wwbCopy.close();// Closing the original work bookwbook.close();}catch(Exceptione){e.printStackTrace();}}publicstaticvoidmain(String[]args)throwsWriteException{DataSheetds=newDataSheet();ds.readExcel();ds.setValueIntoCell("sheet1",5,1,"PASS");ds.setValueIntoCell("sheet1",5,2,"FAIL");ds.setValueIntoCell("sheet1",5,3,"PASS");ds.closeFile();}}

[3]

See also

Related Research Articles

<span class="mw-page-title-main">Java (programming language)</span> Object-oriented programming language

Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. It is a general-purpose programming language intended to let programmers write once, run anywhere (WORA), meaning that compiled Java code can run on all platforms that support Java without the need to recompile. Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of the underlying computer architecture. The syntax of Java is similar to C and C++, but has fewer low-level facilities than either of them. The Java runtime provides dynamic capabilities that are typically not available in traditional compiled languages.

JUnit is a unit testing framework for the Java programming language. JUnit has been important in the development of test-driven development, and is one of a family of unit testing frameworks which is collectively known as xUnit that originated with SUnit.

<span class="mw-page-title-main">Microsoft Excel</span> Spreadsheet editor, part of Microsoft 365

Microsoft Excel is a spreadsheet editor developed by Microsoft for Windows, macOS, Android, iOS and iPadOS. It features calculation or computation capabilities, graphing tools, pivot tables, and a macro programming language called Visual Basic for Applications (VBA). Excel forms part of the Microsoft 365 suite of software.

<span class="mw-page-title-main">Jakarta Servlet</span> Jakarta EE programming language class

A Jakarta Servlet, formerly Java Servlet is a Java software component that extends the capabilities of a server. Although servlets can respond to many types of requests, they most commonly implement web containers for hosting web applications on web servers and thus qualify as a server-side servlet web API. Such web servlets are the Java counterpart to other dynamic web content technologies such as PHP and ASP.NET.

Apache POI, a project run by the Apache Software Foundation, and previously a sub-project of the Jakarta Project, provides pure Java libraries for reading and writing files in Microsoft Office formats, such as Word, PowerPoint and Excel.

<span class="mw-page-title-main">Java syntax</span> Set of rules defining correctly structured program

The syntax of Java is the set of rules defining how a Java program is written and interpreted.

Javadoc is a documentation generator created by Sun Microsystems for the Java language for generating API documentation in HTML format from Java source code. The HTML format is used for adding the convenience of being able to hyperlink related documents together.

In computing, the Win32 Thread Information Block (TIB) is a data structure in Win32 on x86 that stores information about the currently running thread. It is also known as the Thread Environment Block (TEB) for Win32. It descended from, and is backward-compatible on 32-bit systems with, a similar structure in OS/2.

In the Java computer programming language, an annotation is a form of syntactic metadata that can be added to Java source code. Classes, methods, variables, parameters and Java packages may be annotated. Like Javadoc tags, Java annotations can be read from source files. Unlike Javadoc tags, Java annotations can also be embedded in and read from Java class files generated by the Java compiler. This allows annotations to be retained by the Java virtual machine at run-time and read via reflection. It is possible to create meta-annotations out of the existing ones in Java.

Selenium is an open source umbrella project for a range of tools and libraries aimed at supporting browser automation. It provides a playback tool for authoring functional tests across most modern web browsers, without the need to learn a test scripting language. It also provides a test domain-specific language (Selenese) to write tests in a number of popular programming languages, including JavaScript (Node.js), C#, Groovy, Java, Perl, PHP, Python, Ruby and Scala. Selenium runs on Windows, Linux, and macOS. It is open-source software released under the Apache License 2.0.

ExtenXLS is a Java Excel Reporting Toolkit developed by Extentech. It is a Reporting API that allows for the reading in, modifying and creation of spreadsheet-based reports from Java applications.

<span class="mw-page-title-main">Origin (data analysis software)</span>

Origin is a proprietary computer program for interactive scientific graphing and data analysis. It is produced by OriginLab Corporation, and runs on Microsoft Windows. It has inspired several platform-independent open-source clones and alternatives like LabPlot and SciDAVis.

Jakarta Mail is a Jakarta EE API used to send and receive email via SMTP, POP3 and IMAP. Jakarta Mail is built into the Jakarta EE platform, but also provides an optional package for use in Java SE.

In software engineering, a fluent interface is an object-oriented API whose design relies extensively on method chaining. Its goal is to increase code legibility by creating a domain-specific language (DSL). The term was coined in 2005 by Eric Evans and Martin Fowler.

In computer science, marshalling or marshaling is the process of transforming the memory representation of an object into a data format suitable for storage or transmission, especially between different runtimes. It is typically used when data must be moved between different parts of a computer program or from one program to another.

BioPAX is a RDF/OWL-based standard language to represent biological pathways at the molecular and cellular level. Its major use is to facilitate the exchange of pathway data. Pathway data captures our understanding of biological processes, but its rapid growth necessitates development of databases and computational tools to aid interpretation. However, the current fragmentation of pathway information across many databases with incompatible formats presents barriers to its effective use. BioPAX solves this problem by making pathway data substantially easier to collect, index, interpret and share. BioPAX can represent metabolic and signaling pathways, molecular and genetic interactions and gene regulation networks. BioPAX was created through a community process. Through BioPAX, millions of interactions organized into thousands of pathways across many organisms, from a growing number of sources, are available. Thus, large amounts of pathway data are available in a computable form to support visualization, analysis and biological discovery.

<span class="mw-page-title-main">Sheetster</span>

Sheetster is a GPL open-source Web Spreadsheet and a Java Application Server created by Extentech Inc. The product was created for the enterprise and small and medium-sized businesses as an Open Source alternative to closed document management systems.

<span class="mw-page-title-main">FarPoint Spread</span> Computer software

FarPoint Spread is a suite of Microsoft Excel-compatible spreadsheet components available for .NET, COM, and Microsoft BizTalk Server. Software developers use the components to embed Microsoft Excel-compatible spreadsheet features into their applications, such as importing and exporting Microsoft Excel files, displaying, modifying, analyzing, and visualizing data. Spread components handle spreadsheet data at the cell, row, column, or worksheet level.

In software engineering, the module pattern is a design pattern used to implement the concept of software modules, defined by modular programming, in a programming language with incomplete direct support for the concept.

JExcel is a library (API) to read, write, display, and modify Excel files with .xls or .xlsx formats. API can be embedded with Java Swing and AWT.

References

  1. "jxlapi". Sourceforge. Sourceforge. Retrieved 16 August 2023.
  2. 1 2 Sams, P. (2015). Selenium Essentials. Birmingham: Packt publishing Ltd. p. 133.
  3. "How to Set Data into Excel sheet using jxl". Selenium Easy. Selenium Easy. Retrieved 1 February 2016.