Article
· Nov 28, 2023 2m read

java-excel-iris uses java code to read Excel data and store it into IRIS global

My newest app includes a java routine to read data from Excel 95, 97, 2000, XP, and 2003 workbooks and write the data into IRIS globals using Java Native API library.

If you have Git and Docker installed, clone/git pull the repo into any local directory

$ git clone https://github.com/oliverwilms/excel-java-iris.git

Open the terminal in this directory and run:

$ docker-compose up -d

Execute java class IRISNative

$ docker-compose exec -it iris java IRISNative

Press Enter to accept the default /opt/irisapp/excel/money.xls.

>>> Input File [/opt/irisapp/excel/money.xls]

image

The java code reads data from an Excel workbook. You can see the data in IRIS

$ docker-compose exec -it iris iris session iris
USER>zw ^excel
^excel(0,0,0)="Date"
^excel(0,0,1)="Check"
^excel(0,0,2)="Merchant"
^excel(0,0,3)="Category"
^excel(0,0,4)="SubCategory"
^excel(0,0,5)="Memo"
^excel(0,0,6)="Credit"
^excel(0,0,7)="Debit"
^excel(0,0,8)="Account"
^excel(0,0,9)="Status"
^excel(0,1,0)="27-Nov"
^excel(0,1,1)=101
^excel(0,1,2)="Landlord"
^excel(0,1,3)="Business Expense"
^excel(0,1,4)="Rent"
^excel(0,1,5)="December"
^excel(0,1,7)=250
^excel(0,1,8)="Checking"
^excel(0,2,0)="27-Nov"
^excel(0,2,2)="Aldi"
^excel(0,2,3)="Groceries"
^excel(0,2,5)=16
^excel(0,2,7)=54.35
^excel(0,2,8)="Checking"

Import Excel data from IRIS global into IRIS persistent class

USER>w ##class(otw.iris.excel).importExcel(-1)
1

I added -1 above because I want to start importing with sheet 0. In my personal Excel workbook, I want to skip the first five workbooks.

Finally we can see the data in SQL

image

Discussion (1)1
Log in or sign up to continue