Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Apache POI is a family of Java libraries for reading, writing, and extracting content from Microsoft Office files. It has separate components for legacy binary formats such as Excel .xls and modern Office Open XML (OOXML) formats such as .xlsx and .docx. Choose the component and API to match the file format and workload; POI is not one universal API with identical support for every Office feature.

What Apache POI does

The Apache POI project provides pure-Java APIs for manipulating file formats based on Microsoft’s OLE 2 Compound Document format and Office Open XML (OOXML). Its uses include creating and editing Office documents as well as extracting text for web spiders, search index builders, and content-management systems. See the Apache POI project homepage and its component overview.

Think of POI as a set of format-specific components. Some APIs offer a shared programming model across related file types, but the underlying formats and feature coverage differ.

Choose a component for the file you need to handle

Task Component Format Practical consideration
Read or write legacy Excel HSSF .xls (BIFF8) Uses the older binary Excel format; common SS usermodel APIs can also abstract over XLS and XLSX.
Read or write modern Excel XSSF .xlsx (OOXML) The full usermodel is convenient for document editing, but can require more memory.
Generate very large Excel workbooks SXSSF .xlsx Designed to reduce memory use by retaining a sliding window of rows; rows flushed out of that window are no longer available for ordinary access.
Read or write legacy Word HWPF .doc Advanced-feature support is less complete; support for older Word 6/95 files is limited and read-only.
Read or write modern Word XWPF .docx Useful for simpler documents and text extraction, but validate the features your files depend on.
Read or write PowerPoint HSLF / XSLF .ppt / .pptx Separate implementations handle legacy binary and OOXML presentations.

POI also has components for Visio (HDGF/XDGF), Publisher (HPBF), Outlook messages (HSMF), Outlook winmail.dat / TNEF attachments (HMEF), document properties (HPSF), and shared drawing and OOXML infrastructure. The official component and artifact guide maps these features to Maven artifacts.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Which Maven dependency should you use?

The required artifact depends on the formats and features in your application. Common choices include poi for core and legacy-format functionality, poi-ooxml for OOXML formats, and poi-scratchpad for several specialized or less mature legacy components. Optional artifacts include poi-ooxml-lite, poi-ooxml-full, and poi-examples. Do not assume that one dependency covers every Office format; consult the artifact map for the component you plan to use.

Pick the API to fit the workload

Usermodel for straightforward editing

For ordinary document creation and editing, the usermodel APIs provide higher-level objects for working with workbook, sheet, row, cell, and document structures. The shared SS usermodel covers both HSSF and XSSF spreadsheet work, while format-specific APIs handle their distinct capabilities.

Eventmodel for read-only spreadsheet processing

When processing spreadsheets without needing to load and edit the full workbook model, eventmodel APIs can be a more efficient option for read-only work. They are worth considering for extraction or other streaming-style processing.

SXSSF for large XLSX generation

For writing very large XLSX files, SXSSF keeps a sliding window of rows accessible rather than retaining the entire workbook in memory. This trade-off can reduce memory pressure, but code cannot freely revisit rows after they have been flushed. Choose it for sequential generation, not when later edits must access earlier rows.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A practical workflow for starting with POI

  1. Identify the format. Check the extension and whether the file is a legacy binary format (.xls, .doc, .ppt) or OOXML (.xlsx, .docx, .pptx).
  2. Select the matching artifact. Start with poi for core or legacy needs and poi-ooxml for OOXML needs. Add other artifacts only when the component guide indicates they are required.
  3. Choose the access model. Use a usermodel for conventional editing, eventmodel APIs for efficient read-only spreadsheet processing, or SXSSF for large XLSX exports with sequential row writing.
  4. Verify feature coverage. If your files rely on charts, drawings, signatures, encryption, or advanced Word constructs, check the official component documentation and encryption support information for the specific format and feature.
  5. Use project examples as a starting point. POI distributes examples as the poi-examples artifact; the component guide links to official examples.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What to check before relying on POI for complex files

Support is not equally complete across formats or Office features. The official Word guide describes HWPF and XWPF as moderately functional, with stronger text-extraction support than support for some advanced document features. Test against representative files if your application needs complex layouts or specialized constructs. In particular, confirm behavior for charts, drawings, signatures, and encrypted documents against the format-specific documentation rather than assuming that a feature available in Microsoft Office is fully supported by POI.

Encryption support varies by file format and encryption mode. The POI encryption guide describes the supported cases; check it before designing a workflow for protected files.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.