This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes Excel - IOException Invalid Header signature Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Excel - IOException Invalid Header signature" Watch "Excel - IOException Invalid Header signature" New topic

Excel - IOException Invalid Header signature

Nidhi Singhal
Ranch Hand

Joined: Sep 19, 2004
Posts: 89


I have a utility for export and import of data. I am saving a file in excel format and then importing the same file to the database.
When I try to import the same exported file, I get IOException - Invalid Header signature. But, if I first open the exported file in MS excel and then do - save as (in excel format) and then Import that saved file, I don't get the error.
I find out that when I export the file, it saves the file in text format only along with with .xls extention. The MS Excel converts the text file into Excel while reading. But the file exported is not actually an excel worksheet so the Import of the same file does not works.
Is there any solution to this problem. I am already using response.setContentType("application/");

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 39547
What kind of export and import code is that - do you have control over it (meaning, can you fix it)? If not, I'd talk to the vendor of whatever software you're using, and get a version that doesn't export a non-XLS file as XLS.

Ping & DNS - updated with new look and Ping home screen widget
subject: Excel - IOException Invalid Header signature
Similar Threads
Aspose.Total Product Family Q3 2010 Released
Exporting / Importing a file using hyperlink
Does Open option create a new Excel sheet
Import from and export to Excel
How to generate real excel reports