Solved

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

Posted on 2013-02-01
16
741 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
  • 8
  • 6
  • 2
16 Comments
 
LVL 29

Expert Comment

by:gowflow
Comment Utility
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
Comment Utility
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
Comment Utility
well then we hv a tough one here. let me try something and will get back to you.
gowflow
0
 
LVL 2

Author Comment

by:Abhishek Chakravarty
Comment Utility
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
Comment Utility
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
Comment Utility
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 33

Expert Comment

by:Norie
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 33

Expert Comment

by:Norie
Comment Utility
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
Comment Utility
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
Comment Utility
Any chance to have tried the proposed solution ?
gowflow
0
 
LVL 2

Author Comment

by:Abhishek Chakravarty
Comment Utility
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
Comment Utility
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
Comment Utility
Any chance to hv tried it out ?
gowlfow
0
 
LVL 2

Author Closing Comment

by:Abhishek Chakravarty
Comment Utility
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
Comment Utility
Your welcome and glad I could help.
gowflow
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
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 will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now