Read xlsx from webGl build

Hello. I successfully red xlsx file from streaming assets with NPOI library in editor/pc build/android build but got an error with WebGL.
Does enibody have a library to read xlsx in webgl?
No csv question.
Or if you have solution to convert xlsx to csv in webgl runtime, I am interested.

What kind of error are you getting? Is it an error parsing the file, or is it an error reading the file in the first place?

If it’s the latter, note this:

from

1 Like

There’s at least two parts to this and until you figure out what is happening, it will be very difficult to fix.

Are you unable to READ the file data?

Or are you unable to push it through this NPOI library you speak of?

Or something else perhaps?

Keep in mind WebGL builds lack things like threads and other niceties that some libraries need.

1 Like

The excel file successfully red in webgl from streaming assets with unitywebrequest. Just like i do with csv , txt, jpg.
The error appears then I put memory stream into the library method to create the book from stream.
So I guess it is related to library incompatible with webgl.
Te error:
InvalidCastException specified cast is not valid.
Rethrow as POIXMLException at NPOI.XSSF.Usermodel.XSSFFacrory.CreateDocumentPart…
It works on android build and PC build…

Possibly, but one more thing to check is code stripping.

Code that is not referenced in code may be subject to stripping on certain built targets.

This may be a problem if you have code that produces a class object instance by reflection.

You can tell Unity to NOT strip certain namespaces (google for that), and I think you can also disable it entirely to prove first if this might be what you are seeing.

The code sctripping set to low and there is no option to disable it in Unity 2020.1.8.
With one of short test excel file get error in internet browser while running webgl build:
NotSupportedException: Encoding 437 data could not be found. Make sure you have correct international codeset assembly installed and enabled. at System.Text.Encoding.GetEncoding (System.Int32 codepage) [0x00000] in <00000000000000000000000000000000>:0 (Filename: currently not available on il2cpp Line: -1)

if anyone have the same issue, follow the github link where I successfully solved the problem.

1 Like