buzzzzjay
buzzzzjay

Reputation: 1150

C# Reading Excel Data From Cells in VS2010

I am writing a C# Console Application and I am correctly opening an Excel file. I just can't figure out how to read data from cells and copy it into an array. Most of the code I have found list examples that won't work with VS 2010. It appears they have changed how to read cell data in every version. I am wanting to read a variable amount of rows depending on how long the data goes. I am wanting to read cells [B8]-[*8].

I have spend a couple of days on this without much luck.

Thanks very much, BuZzZzJaY

Upvotes: 0

Views: 2156

Answers (1)

Gaurav Saxena
Gaurav Saxena

Reputation: 155

You can use this method workSheet.get_Range("A1", "A1").EntireRow.EntireColumn

use bellow code this is 2d array. Iterate in this

Object[,] obj = (object[,])sheet.get_Range("A1", "B4").Value2;

Upvotes: 1

Related Questions