U
U
un1t2020-11-03 16:46:07
Android
un1t, 2020-11-03 16:46:07

Android - how to parse .xlsx (getting SAXNotRecognizedException)?

I'm trying to parse an excel file using apache.poi: An

error occurs:

Caused by: org.xml.sax.SAXNotRecognizedException: http://xml.org/sax/properties/declaration-handler


build.gradle
dependencies {
    ...
    implementation 'javax.xml.stream:stax-api:1.0'
    implementation 'org.apache.poi:poi:4.1.2'
    implementation 'org.apache.poi:poi-ooxml:4.1.2'
    implementation 'org.apache.poi:poi-ooxml-schemas:1.4'


the code:
var inputStream = assets.open("sample.xlsx")
val book = XSSFWorkbook(inputStream)
val sheet = book.getSheetAt(0)


Tell me, what could be the error, or maybe there are some other libraries?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Vodakov, 2020-11-03
@WaterSmith

The first thing to check is if the "sample.xlsx" file exists where your code is trying to open it from.
And the second: is this file valid, maybe you have it broken at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question