我想通过使用 linqtoexcel 找到 excel 列的最大值。ColumnA ColumnB 1 1 2 4 3 3这将返回“最大 ColumnA 为 3” “最大 ColumnB 为 4”
1 回答

白衣染霜花
TA贡献1796条经验 获得超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 关注
- 146 浏览
添加回答
举报
0/150
提交
取消