I have a module in a Java application that reads and processes .xls , .xlsx .csv .
It is a web application, where the user uploads a file with some of these formats, via rest, and when the file is on the server, my Java application processes it.
This process consists of reading the file, sweeping field by field, or column by column, picking up the data, to insert them into the database. Until this moment I have no problem. I was able to make my application work properly using APACHE-POI .
The big problem is that one of the files that the user needs to import for my application to process, is generated by an SAP. And it's saved as .xls , but at the time my application tries to read the file it brings me the exception:
java.io.IOException: Invalid header signature; read 0x0020000A000DFEFF, expected 0xE11AB1A1E011CFD0 - Your file appears not to be a valid OLE2 document
And from what I've researched, this exception says that my .xls file is not an .xls file.
I've been browsing, and it's as if SAP exported a .csv file, but it sends it with the .xls extension. If I open the file and give a save such as .xls , or .csv , the process works correctly.
An alternative to the solution I thought was, if it is a .xls , and this exception occurs in particular, I send the file to the method that reads .csv and it processes. It literally worked, I can "read" the file, but I can not extract the data, as it seems the file does not have the field delimiter defined.
[UPDATE]
IwasabletogetthecorrectfieldbysettingthedelimitertoTab.Accordingtotheimage,atthedebugtime,thevalueofthe[i]fieldisempty,andinsideitIhavethe"value", which is really the value that I need. But I have no idea how to get this value, can anyone help me?