Solved

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

Posted on 2013-02-01
16
766 Views
Last Modified: 2013-02-15
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
Comment
Question by:Abhishek Chakravarty
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 6
  • 2
16 Comments
 
LVL 29

Expert Comment

by:gowflow
ID: 38846933
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
 
LVL 2

Author Comment

by:Abhishek Chakravarty
ID: 38847815
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
 
LVL 29

Expert Comment

by:gowflow
ID: 38848062
well then we hv a tough one here. let me try something and will get back to you.
gowflow
0
Independent Software Vendors: 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!

 
LVL 2

Author Comment

by:Abhishek Chakravarty
ID: 38867248
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
 
LVL 29

Expert Comment

by:gowflow
ID: 38867661
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
 
LVL 2

Author Comment

by:Abhishek Chakravarty
ID: 38867796
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
 
LVL 34

Expert Comment

by:Norie
ID: 38867896
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
 
LVL 2

Author Comment

by:Abhishek Chakravarty
ID: 38870535
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
 
LVL 34

Expert Comment

by:Norie
ID: 38871268
Abhishek

What I'm suggesting is opening the file once, not multiple times and not saving the file.
0
 
LVL 29

Accepted Solution

by:
gowflow earned 500 total points
ID: 38871438
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
 
LVL 29

Expert Comment

by:gowflow
ID: 38872500
Any chance to have tried the proposed solution ?
gowflow
0
 
LVL 2

Author Comment

by:Abhishek Chakravarty
ID: 38872516
Just got online. cannot check on sunday.No feeds. Will have to be tommorrow. Thanks i will try your solution gowflow.
0
 
LVL 29

Expert Comment

by:gowflow
ID: 38872551
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
 
LVL 29

Expert Comment

by:gowflow
ID: 38880946
Any chance to hv tried it out ?
gowlfow
0
 
LVL 2

Author Closing Comment

by:Abhishek Chakravarty
ID: 38893424
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
 
LVL 29

Expert Comment

by:gowflow
ID: 38894128
Your welcome and glad I could help.
gowflow
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question