Apache.poi.hssf access from script console for excel import


I am hoping to import data from an excel sheet to Ignition. At first I thought openpyxl but couldn’t get that to work (saw a post about openpyxl having C dependencies and not working in Jython). Next was org.apache.poi.hssf but it appears these functions aren’t available via script console.

import org.apache.poi
# ‘[__name__]’

I can find both poi-4.1.1.jar and poi-ooxml-4.1.1.jar in Ignition/lib/core/common which are the requirements listed in the poi documentation, so I thought that would be enough to get access to the poi libraries (I’m very new to Java though). It looks like the next step is either buying or making an Ignition module, which is why I’m asking for assistance now.

I saw similar topics previously but they were from 2017 and used poi-3.1.14 so I wasn’t sure if there had been a change, eg.:
Importing and using 3rd party Java jar libraries in Ignition - General Discussion - Inductive Automation Forum

Jython generally does not support listing contents of java packages. You must import explicitly (no wildcards). I recommend imports of the form:

from org.apache.poi.hssf import SomeClass, SomeOtherClass
1 Like
1 Like