Click here to Skip to main content
14,766,265 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am reading from an excel file to display information in a gridview. Unfortunately, this file has to remain closed in order for me to read it. And even more unfortunately, it is a file that is constantly being opened to be updated. Any advice will be welcomed.


What I have tried:

I looked into creating a macro but I was unable to get that to work. And Im pretty sure the people who will have to update this file will not be familiar with macros.
Updated 10-Feb-16 12:22pm

1 solution

You have no choice but to open it, or make a copy of it and open the copy. In either case, the file will be unavailable for update during the read by your code or during the copy operation.

The real solution is to NOT use an Excel sheet as a database. Use a real database engine and if you need to manipulate the data in Excel, load it from the database using Excel's data functionality, which can import from an SQL database.
Member 10736689 29-Feb-16 9:18am
I managed to get it working using a macro. The purpose of the web application was to just read data from an excel file. Manipulation of the data by the stakefolders remained within an excel file.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900