Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8600407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:36:37+00:00 2026-06-12T01:36:37+00:00

I am using Apache poi 3.8 for reading xls file, but i got exception:

  • 0

I am using Apache poi 3.8 for reading xls file, but i got exception:

        java.io.IOException: Unable to read entire header; 0 bytes read; expected 512 bytes
        at org.apache.poi.poifs.storage.HeaderBlock.alertShortRead(HeaderBlock.java:226)
        at org.apache.poi.poifs.storage.HeaderBlock.readFirst512(HeaderBlock.java:207)
        at org.apache.poi.poifs.storage.HeaderBlock.<init>(HeaderBlock.java:104)
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:138)

used code sample:

     FileInputStream myInput = new FileInputStream(excelFilePathWithExtension);
     logger.debug("FileInputStream::"+myInput);

     POIFSFileSystem myFileSystem = new POIFSFileSystem(myInput);
     logger.debug("POIFSFileSystem::"+myFileSystem);

     Workbook workbook = WorkbookFactory.create(myFileSystem);

please help me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T01:36:38+00:00Added an answer on June 12, 2026 at 1:36 am

    If we take a look at the HeaderBlocks class, we can see these blocks :

    public HeaderBlock(InputStream stream) throws IOException {
        // Grab the first 512 bytes
        // (For 4096 sized blocks, the remaining 3584 bytes are zero)
        // Then, process the contents
        this(readFirst512(stream));
        ...
    }
    

    The constructor you used will read the first 512 bytes of your inputstream then call a private constructor.

    And the readFirst512 method throw an exception if there is not enough bytes to read.

    Also, the POI’s document say that a POI file system structure starts starts with a header block of 512 bytes.

    So… It seems that your file is not big enough for POI.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to read the 2010 excel file in java using apache poi api
I am using Apache POI 3.8 libraries to read an XLSX file in a
I'm using Apache POI 3.6, I want to read an excel file which has
I am using Apache POI to read xlsx file, it works well. I have
I'm trying to read .xlsm file using Apache POI library (3.8-beta5): Workbook wb =
I am reading an xlsx file using XSSF of Apache POI. When reading the
Using Apache POI HSSF, we can create xls file like this private void write(HSSFWorkbook
I am generating xlsx file using Apache POI. On making the war and deploying
I'm able to create an excel file using apache poi. however, i want users
I'm trying to set Excel cell colors using Apache POI in Java. I played

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.