Link to home
Start Free TrialLog in
Avatar of Abhishek Chakravarty
Abhishek ChakravartyFlag for India

asked on

Reading excel(xls) data from a unsaved instance using C#

I am new to expert-exchange so if this ques has been handled pls guide me to it.
I have a excel file where data is being updated online from a external source like being used for rates of currencies or commodities. Data in cells are being updated every few seconds. I have to read that unsaved instances of data from c# application. I know and have been able to get data from saved instances of xls file but not unsaved. Any help or guidance will be welcome.
Avatar of Jacques Geday
Jacques Geday
Flag of Canada image

well we can make the unsave save !!!
like a small macro in that Excel to save the workbook say every minute ... then anytime you connect to that file you will be at an accuracy of +- 1 minute is that a workbable option for you ?
gowflow
Avatar of Abhishek Chakravarty

ASKER

Sorry gowflow, This is not a workable solution. I cannot do any changes to the to the excel file to add macro etc/ The file has been given to me by the feed company.
Thanks for the suggestion though.

Abhishek Chakravarty
well then we hv a tough one here. let me try something and will get back to you.
gowflow
Thanks goflow for trying.
I am trying to form a solution on the advice given above.
----
ike a small macro in that Excel to save the workbook say every minute ... then anytime you connect to that file you will be at an accuracy of +- 1 minute is that a workbable option for you ?
---
But my excel macro knowledge is a bit limited how do i do the above thing? Thanx in advance
yes sure no sweat. Can you post just a sample of your workbook so I install in it the major things and then you can move your sensitive data to it. As the other option would be too cumbersome and would need a lot of explanation as you are not v inclined in programing.

Would that be possible for you to post a limited version of your workbook ?
gowflow
Pls find the file attached. I have removed all data except 1 line so that u can understand what it is doing.
Thanks
Abhishek
Arbitrage.xls
Avatar of Norie
Norie

Abhishek

What you could do is create am instance of Excel and open the file in that instance.

Then you should be able to access the data in the workbook without needing to save it.

You could setup code to run at a specific interval, eg every second.

One question, you mention a C# application.

Is that an existing application?
Imnorie
I tried to do that.
Actually first let me tell u what i am trying to do. I have got a third-party application which giveds feed of prices of commodities and international currencies. It has a option outputting the rates into a excel file attached above. I am building a c# app which will take data from that excel file for reports and graphs.
Now that excel has data changing everry few seconds. Solution u proposed opens last saved instance (or thge way i did it). i want the current unsaved instance.
Thanks

Abhishek
Abhishek

What I'm suggesting is opening the file once, not multiple times and not saving the file.
ASKER CERTIFIED SOLUTION
Avatar of Jacques Geday
Jacques Geday
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Any chance to have tried the proposed solution ?
gowflow
Just got online. cannot check on sunday.No feeds. Will have to be tommorrow. Thanks i will try your solution gowflow.
Your welcome. You can at least open the file I posted and check this file for what I mentioned, unless u cannot for other reasons. Just to see if all well at yours.
gowflow
Any chance to hv tried it out ?
gowlfow
Even though this was the solution i was not looking for. But this solution suits me just fine. I have been able to complete my software thanks gowflow
Your welcome and glad I could help.
gowflow