Welcome to Dream.In.Code
Become a VB Expert!

Join 137,261 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,560 people online right now. Registration is fast and FREE... Join Now!




Excel Spreadsheet Data

 
Reply to this topicStart new topic

Excel Spreadsheet Data, Reading Excel data in VB 2005 Express

danfwald
9 Nov, 2006 - 02:30 PM
Post #1

New D.I.C Head
*

Joined: 25 Jul, 2006
Posts: 11


My Contributions
I need to read several columns of Excel spreadsheet data in VB arrays. In looking at some of the VB literature it seems possible, but I have no idea how to do it.
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Excel Spreadsheet Data
9 Nov, 2006 - 03:07 PM
Post #2

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 6,985



Thanked: 44 times
Dream Kudos: 500
Expert In: C#, VB.NET, Java

My Contributions
Here is a link which gives a great example of what you want to do. It actually deals with automating excel from VB, but it does show you how to read data from a spreadsheet from a range of cells into an array.

http://support.microsoft.com/kb/302094
User is offlineProfile CardPM
+Quote Post

danfwald
RE: Excel Spreadsheet Data
10 Nov, 2006 - 03:29 PM
Post #3

New D.I.C Head
*

Joined: 25 Jul, 2006
Posts: 11


My Contributions
QUOTE(jayman9 @ 9 Nov, 2006 - 04:07 PM) *

Here is a link which gives a great example of what you want to do. It actually deals with automating excel from VB, but it does show you how to read data from a spreadsheet from a range of cells into an array.

http://support.microsoft.com/kb/302094


Thanks for your suggestion, but it doesn't quite do what I need. Let me give you a little background. I have a 1 kw solar installation on my roof. The electronics that interfaces the DC generated by the solar cell with the power grid also produces an .xls file which is sent by wireless network to my computer. I read spreadsheet with Quattro 12, remove all the extraneous stuff, and output a .csv file which is read by my Visual Basic 2005 Express program, which generates charts, etc. I do this spreadsheet editing via a macro. It would be simpler and faster to do it with Office Automation if I can figure out how to use it.

The .xls file (attached) is simply a 2-column list of the date and the energy (kWh) generated on that date. I only need to import the last dozen or so rows, since my program appends the updates to a fixed record length file that contains the entire history of the installation.

I have modify the Microsoft example to try read the spreadsheet (attached). My first problem is how to open up the workbook. My second problem is how to read only the last 10-12 rows into an array. However, the basic problem is find some reference book that explains what all the hundreds of methods associated with the Excel Interop do together with some meaningful examples. Intellisense does help that much. Can you help me?

Dan

User is offlineProfile CardPM
+Quote Post

gabr44
RE: Excel Spreadsheet Data
17 Dec, 2007 - 04:02 PM
Post #4

New D.I.C Head
*

Joined: 3 Nov, 2007
Posts: 1


My Contributions
i need to read sheet as array from vb.net

the sheet form from rows and columns that it is like array with two dimensions. i want to use it as array then plot the values every two valuse as point

how i know the number of rows and columns which have values to write next for
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/4/08 06:51PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month