user1269015
user1269015

Reputation:

Getting data from Excel sheet

I'm trying to write an Excel add-in using Microsoft Visual C# and VSTO. What I'm trying to do is read all of the data in the Excel sheet into a list of some sort so that I can process the list and write the list back to the sheet.

So far I have been unable to get any of the examples of the MSDN site to work.

Upvotes: 0

Views: 248

Answers (1)

D Stanley
D Stanley

Reputation: 152521

You read/write the values from a Range variable into an Array using its Value property. From there you can create a list or leave it as an array - your choice.

I will advise you NOT to read or write the 'Value' property of individual cells in a tight loop as you'll have a significant performance penalty. Read the value into an array, modify the array, then write them back at one time.

Upvotes: 1

Related Questions