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

  • SEARCH
  • Home
  • 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 8526331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:14:31+00:00 2026-06-11T08:14:31+00:00

While trying to open an excel using ApachePOI I get org.apache.poi.openxml4j.exceptions.InvalidOperationException: Can’t open the

  • 0

While trying to open an excel using ApachePOI I get

org.apache.poi.openxml4j.exceptions.InvalidOperationException: Can't open the specified file: 'C:\Users\mdwaipay\AppData\Local\Temp\poifiles\poi-ooxml-1570030023.tmp'

I checked. No such folder is being created. I am using Apache POI version 3.6.

Any help? A similar code was running fine in a different workspace. At loss of thoughts here.

Code:

public Xls_Reader(String path) {
  this.path=path; 
  try { 
      fis = new FileInputStream(path); 
      workbook = new XSSFWorkbook(fis); 
      sheet = workbook.getSheetAt(0); 
      fis.close(); 
  }
  catch (Exception e) 
  { e.printStackTrace(); 
  } 
}
  • 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-11T08:14:33+00:00Added an answer on June 11, 2026 at 8:14 am

    Why are you taking a perfectly good file, wrapping it in an InputStream, then asking POI to have to buffer the whole lot for you so it can do random access? Life is much better if you just pass the File to POI directly, so it can skip about as needed!

    If you want to work with both XSSF (.xlsx) and HSSF (.xls), change your code to be

    public Xls_Reader(String path)  { 
      this.path = path; 
      try { 
        File f = new File(path);
        workbook = WorkbookFactory.create(f); 
        sheet = workbook.getSheetAt(0); 
      } catch (Exception e) {
        e.printStackTrace();
      } 
    }
    

    If you only want XSSF support, and/or you need full control of when the resources get closed, instead do something like

    OPCPackage pkg = OPCPackage.open(path);
    Workbook wb = new XSSFWorkbook(pkg);
    
    // use the workbook
    
    // When you no longer needed it, immediately close and release the file resources
    pkg.close();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to open a series of Excel spreadsheets using an instance of Excel
Basically, I'm trying to open/close a TitleWindow using PopUpManager.addPopUp() and PopUpManager.removePopUp() while reusing the
I am trying to create double and number format cells in excel using NPOI
While trying to send a POST request via xmlhttp.open(POST, url, true) (javascript) to the
I'm trying to read from excel file with oleDB provider using C#: using (var
I'm trying to get a page to show a loading... message while I create
While trying to get a 2008 server to connect to a sql server, I
All of a sudden I start getting this error while trying to open 2
I am trying to get data from Excel File to DataTable. Here's my code-snippet
i am getting the following error while trying to open a Microsoft word document

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.