我想通過使用 linqtoexcel 找到 excel 列的最大值。ColumnA ColumnB 1 1 2 4 3 3這將返回“最大 ColumnA 為 3” “最大 ColumnB 為 4”
1 回答

白衣染霜花
TA貢獻1796條經(jīng)驗 獲得超10個贊
將您的工作簿列映射到 POCO
public class WorkSheetClass
{
public int ColumnA { get; set; }
public int ColumnB { get; set; }
}
然后使用 LinqToExcel
string pathToExcelFile = @"C:\workbook1.xlsx";
string workbookName = "workbook1";
var columnAMaxValue = new ExcelQueryFactory(pathToExcelFile)
.Worksheet<WorkSheetClass>(workbookName)
.Max(x => x.ColumnA);
- 1 回答
- 0 關注
- 135 瀏覽
添加回答
舉報
0/150
提交
取消