繁体   English   中英

如何从excel电子表格的列中找到linqtoexcel的最大值?

[英]How to find max value by linqtoexcel from the column(s) of excel spreadsheet?

我想通过使用linqtoexcel找到excel列的最大值。

ColumnA ColumnB
   1       1
   2       4
   3       3

将返回

“max ColumnA为3”“max ColumnB为4”

将工作簿列映射到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);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM