C#: Getting the number of rows/columns with ExcelPackage

后端 未结 9 625
执念已碎
执念已碎 2021-02-03 18:59

I need to read and write data from an Excel spreadsheet. Is there a method to finding out how many rows/columns a certain worksheet has using ExcelPackage? I have the following

9条回答
  •  误落风尘
    2021-02-03 19:36

    This is what I do:

    To get the array of values on the workbook:

    object[,] valueArray = sheet.Cells.GetValue();
    

    to get the range do the following:

    int rangeMaxRows = sheet.Dimension.End.Row; 
    int rangeMaxColumns = sheet.Dimension.End.Column;
    

提交回复
热议问题