I am trying to get a column, but limiting it to used range...
public static Excel.Application App = new Excel.Application();
public static Excel.Workbook WB;
WB = App.Workbooks.Open("xxx.xls", ReadOnly: true);
var sheet = (WB.Sheets[1] as Excel.Worksheet);
// returns 65536 rows, I want only 82 (used range)
sheet.get_Range("F:F");
sheet.UsedRange.get_Range("F:F").Rows.Count; // 65536
How can I get it?
Sounds like you want the Application.Intersect of the UsedRange and Column("F:F")
You can use
or this
this is the optimized way to read an Excel file column by column (or row by row) :