0

Is it necessary to close the open file manually before I start updating data using Apache POI? I'm getting error "The process cannot acess the file because it is used by another process". Or is there any way if Excel file is open and still I can update it using Java Apache POI?

1
  • Not really a StackOverflow question, but yes. Having files open usually blocks them from any access by other means. The only way to write "code" in Excel files, that also works while they are open is in Visual Basic Commented Oct 10, 2022 at 13:01

1 Answer 1

1

No.

And if you are a window user than Windows itself will not let you do this. Nothing in your code will let you do so, I'm afraid. You need to close the file in Excel first.

I am assuming from your description that you've got the file open yourself, in Excel. You might not be. However something else certainly does - it could be another instance of your Java application, for example. Even make sure stuff like Windows Explorer isn't accessing/using the file, e.g. to check attributes. And until you rule that out, as mentioned Windows itself will block you accessing it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.