diff --git a/ExcelHelper/ExcelHelperFW/ExcelHelper.cs b/ExcelHelper/ExcelHelperFW/ExcelHelper.cs
index 3118b77..6c6ed8f 100644
--- a/ExcelHelper/ExcelHelperFW/ExcelHelper.cs
+++ b/ExcelHelper/ExcelHelperFW/ExcelHelper.cs
@@ -25,7 +25,7 @@ namespace ExcelHelperFW
/// copy path
///
///
- public List> GetData(string sourcePath, string sheetName, bool removeHeader, int rowStartPosition = 1, string tempPath = "./temp_file.xlsx")
+ public List> GetData(string sourcePath, string sheetName, bool removeHeader, int rowStartPosition = 1, Func, bool> continueFunc = null, string tempPath = "./temp_file.xlsx")
{
File.Copy(sourcePath, tempPath, true);
@@ -38,7 +38,7 @@ namespace ExcelHelperFW
Sheet sheet = workbookPart.Workbook.Descendants().FirstOrDefault(s => s.Name == sheetName);
if (sheet == null)
- throw new Exception("Cannot find sheet.");
+ throw new Exception($"Cannot find sheet. (Sheet name: {sheetName})");
WorksheetPart worksheetPart = (WorksheetPart)workbookPart.GetPartById(sheet.Id);
Worksheet worksheet = worksheetPart.Worksheet;
@@ -53,6 +53,9 @@ namespace ExcelHelperFW
if (rowPairs == null || rowPairs.Count < 1)
continue;
+ if (continueFunc != null && continueFunc(rowPairs))
+ continue;
+
data.Add(rowPairs);
}
}