I tried to do that using code:
worksheet.Columns.count();
But there is not method count()
for Columns
All code is:
class ExcelReader
{
private XLWorkbook workbook;
private string file;
private IXLWorksheet worksheet;
public ExcelReader(string file) {
this.workbook = new XLWorkbook(file);
}
private void ChooseWorksheet(int sheet) {
this.worksheet = workbook.Worksheet(sheet);
}
public int NumberColumns() {
return this.worksheet.Columns.Count();
}
}