【发布时间】:2019-04-09 22:44:16
【问题描述】:
我想使用 linqtoexcel 查找 excel 列的最大值。
ColumnA ColumnB
1 1
2 4
3 3
这将返回
"最大 ColumnA 为 3" “最大 ColumnB 为 4”
【问题讨论】:
标签: c# linq-to-excel
我想使用 linqtoexcel 查找 excel 列的最大值。
ColumnA ColumnB
1 1
2 4
3 3
这将返回
"最大 ColumnA 为 3" “最大 ColumnB 为 4”
【问题讨论】:
标签: c# linq-to-excel
将您的工作簿列映射到 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);
【讨论】: