public void Run() { var result = Timer.TimeFunc(() => { var fileStream = File.Open(@"./Files/profiles-with-validation-errors.csv", FileMode.Open); var sheet = _sheetProvider.GetFromStream(fileStream, ';'); return(_sheetMapper.Map <Profile>(sheet)); }); foreach (var error in result.Item1.ValidationErrors) { Console.WriteLine($"Column: {error.ColumnName} | Row: {error.RowIndex} | Message: {error.ErrorMessage}"); } Console.WriteLine($"Mapped {result.Item1.ParsedModels.Count} models in {result.Item2.ToString()} " + $"with {result.Item1.ValidationErrors.Count} validation errors"); Console.WriteLine("==============================================================="); }
public void Run() { var result = Timer.TimeFunc(() => { var excelRange = new ExcelRange(new ExcelCell("A", 1), new ExcelCell("U", 9995)); var sheet = _sheetProvider.GetFromPath(@"./Files/Sample - Superstore.xlsx", "orders", excelRange); return(_sheetMapper.Map <Superstore>(sheet)); }); foreach (var error in result.Item1.ValidationErrors) { Console.WriteLine($"Column: {error.ColumnName} | Row: {error.RowIndex} | Message: {error.ErrorMessage}"); } Console.WriteLine($"Mapped {result.Item1.ParsedModels.Count} models in {result.Item2.ToString()} " + $"with {result.Item1.ValidationErrors.Count} validation errors"); Console.WriteLine("==============================================================="); }
public async Task Run() { var result = await Timer.TimeFuncAsync(async() => { var sheet = await _sheetProvider.GetAsync( _appSettings.SheetId, "'Herstructurering Filters Data'!A1:H9", _appSettings.ApiKey); return(_sheetMapper.Map <EpicTracking>(sheet)); }); foreach (var error in result.Item1.ValidationErrors) { Console.WriteLine($"Column: {error.ColumnName} | Row: {error.RowIndex} | Message: {error.ErrorMessage}"); } Console.WriteLine($"Mapped {result.Item1.ParsedModels.Count} models in {result.Item2.ToString()} " + $"with {result.Item1.ValidationErrors.Count} validation errors"); Console.WriteLine("==============================================================="); }
public async Task Run() { var result = await Timer.TimeFuncAsync(async() => { var sheet = await _sheetProvider.GetAsync("SheetToObjects-a96682815641.json", "SheetToObjects demo", "1cxAOIdNlb2UJ8h5ADUyqiolQt7znf-S7AAEKJV8VpJc", "'store'!A1:U9995"); return(_sheetMapper.Map <Superstore>(sheet)); }); foreach (var error in result.Item1.ValidationErrors) { Console.WriteLine($"Column: {error.ColumnName} | Row: {error.RowIndex} | Message: {error.ErrorMessage}"); } Console.WriteLine($"Mapped {result.Item1.ParsedModels.Count} models in {result.Item2.ToString()} " + $"with {result.Item1.ValidationErrors.Count} validation errors"); Console.WriteLine("==============================================================="); }