Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 825
  • Last Modified:

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.
0
Abhishek Chakravarty
Asked:
Abhishek Chakravarty
  • 8
  • 6
  • 2
1 Solution
 
gowflowCommented:
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
0
 
Abhishek ChakravartyAuthor Commented:
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
0
 
gowflowCommented:
well then we hv a tough one here. let me try something and will get back to you.
gowflow
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Abhishek ChakravartyAuthor Commented:
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
0
 
gowflowCommented:
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
0
 
Abhishek ChakravartyAuthor Commented:
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
0
 
NorieCommented:
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?
0
 
Abhishek ChakravartyAuthor Commented:
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
0
 
NorieCommented:
Abhishek

What I'm suggesting is opening the file once, not multiple times and not saving the file.
0
 
gowflowCommented:
Abhishek

Are you still intrested in the solution I proposed ?
If you ar ethen here it is:

This is your file you posted when you run it the first time it will open a form when youcan input the frequency you wish the workbook would save. To test it first I suggest you choose a samll value like 10 seconds (it is split in Hours minutes and seconds) just enter 10 in seconds and press on Schedule
now keep an eye in the Status bar at the lowest bottom left of the window it says Ready wait for 10 sec and then in the ribbon  you will see it instantanously showing Saving .. then back to Ready and it will keep doing this for each and every 10 seconds.

Now it is made in a way that you can change this setting any time you wish. To do so, it update your menu automatically with a new Menu if you are using Excel 2007 and up the Last Menu is Add-Ins click on it and you will see New Menu click on it and you will see a sub Menu Called Set Frequency Save click on it and it will open the Form you saw previously and here you may change the setting to whatever laps you want. Press on schedule and it will automatically take the new setting.

Anytime you press in this form on the Red button Un-Schedule it will automatically stop the Save Scheduling until next time you decide otherwhyse.

When the workbook is closed it saves its data pertinent to this macro in ht registry so that any time you open it again it picks up the last settings.

Let me know if this works for you.
gowflow
Arbitrage.xls
0
 
gowflowCommented:
Any chance to have tried the proposed solution ?
gowflow
0
 
Abhishek ChakravartyAuthor Commented:
Just got online. cannot check on sunday.No feeds. Will have to be tommorrow. Thanks i will try your solution gowflow.
0
 
gowflowCommented:
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
0
 
gowflowCommented:
Any chance to hv tried it out ?
gowlfow
0
 
Abhishek ChakravartyAuthor Commented:
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
0
 
gowflowCommented:
Your welcome and glad I could help.
gowflow
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

  • 8
  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now