Excel Spreadsheet Data

Reading Excel data in VB 2005 Express

Page 1 of 1

3 Replies - 20084 Views - Last Post: 17 December 2007 - 05:02 PM Rate Topic: -----

#1 danfwald  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 25-July 06

Excel Spreadsheet Data

Posted 09 November 2006 - 03:30 PM

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.
Is This A Good Question/Topic? 0
  • +

Replies To: Excel Spreadsheet Data

#2 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Excel Spreadsheet Data

Posted 09 November 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
Was This Post Helpful? 0
  • +
  • -

#3 danfwald  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 25-July 06

Re: Excel Spreadsheet Data

Posted 10 November 2006 - 04:29 PM

View Postjayman9, on 9 Nov, 2006 - 04:07 PM, said:

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
Was This Post Helpful? 0
  • +
  • -

#4 gabr44  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 03-November 07

Re: Excel Spreadsheet Data

Posted 17 December 2007 - 05:02 PM

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
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1