How to evaluate excel formula through XSSF event API

I read XLSX files using the Apache POI event API, that is, I read the contents of an XLSX sheet through SAX Parser. I want to know how we can get the calculated formula value using the XSSF event API.

As I know, this is to use the FormulaEvaluator class. But since formulaEvaluator accepts an instance of the Workbook class, I don't want to use this approach. (I am reading Excel files containing a million rows and 100 columns, so if I create this Excel's Workbook object, my application server goes out of memory, and so I use the Event API)

How can I evaluate when parsing events without a Workbook instance?

+4
source share
1 answer

Typically, the cached value will be written in the cell, so you can just read it (no need to evaluate)

Taking this formula cell as an example:

  <cr="B10"> <f>SUM(B1:B9)</f> <v>4995</v> </c> 

You read the value of f to get the formula yourself, or just read the value of v to find out what the formula score was when Excel last touched the file. No need to evaluate!

+6
source

All Articles