This project has moved and is read-only. For the latest updates, please go here.

Issue with sheet.GetValue(row, col)

Dec 22, 2011 at 8:27 PM
Edited Dec 22, 2011 at 8:29 PM
I am able to open a spreadsheet (which contains several other worksheets) and reference 
most cell values.

However, when I access a cell that is pulling a value from another worksheet I am having 
an issue.
For example...I have a cell in column 3 and row 17.  If I look at the cell when opened in 
Excel, it has a value of "USD" in it.  If I click on the cell directly I see that it is
actually being pulled from another worksheet (=WORKSHEETxx!$G$7).  When I use the code
below to get this cell's value, I get the following error: 
"Object reference not set to an instance of an object."

My question do I actually get the value "USD" from the cell?

string cellContents = sheet.GetValue(17, 3).ToString().Trim();