1

I want to develop an application which reads data from an MS excel file which is opened.

I want to develop this application because the data is updated for every one minute in the cells present in it and i cant see it again if i want to see. so i want to read the file data and save it in a text file or an ms access file.

I know how to save it but i dont know how to read the ms excel file which is opened.

There would be a great appreciation if someone could help me.

Thanks In Advance.

Magnus Johansson
  • 28,010
  • 19
  • 106
  • 164
Mohd Zubair
  • 237
  • 1
  • 3
  • 7
  • Did you check out [Workbooks.Open](http://msdn.microsoft.com/de-de/library/microsoft.office.interop.excel.workbooks.open%28v=office.11%29.aspx)? If the workbook is constantly open for writing you'll have to open it in Read-Only mode. – Filburt Feb 28 '12 at 10:58
  • possible duplicate: [How to read open excel file at C#](http://stackoverflow.com/questions/4992057/how-to-read-open-excel-file-at-c-sharp) – KMC Feb 28 '12 at 11:04

1 Answers1

0

If I understand your query, you'll need to open the file in read only mode to prevent any access violations from occuring.

(eg. Your app saves some new data and then the open file is saved, removing your saved data)

If you are opening it in read-only, you'll need a refresh timer that will check for revisions of the file. It would only update if the Excel file is saved as you would not be able to access the memory location of an unsaved file.

Perhaps saving your data as .CSV will be easiest to read in to your app. Excel will allow you to save as this type and it is easy to read in C#, using a normal file stream.

Hope this helps.

DIXONJWDD
  • 1,276
  • 10
  • 20