Alex Rivera | Logout

How do I perform File.ReadAllLines on a file that is also open in Excel?

Asked 2012-10-05T10:53:44.313
25

How do I read all lines of a text file that is also open in Excel into string[] without getting IO exception?

There is this question which could be a part of the answer, though I don't know how I could use what's in there: How do I open an already opened file with a .net StreamReader?

c# io
Edit
Report

1 Answer

2

You cannot open file for reading only when it is opened with a read restriction. Otherwise all methods including ReadAllLines will work without throwing permission exceptions.

answered 2012-10-05T12:33:29.103

Your Answer