Skip to content

[BUG] - Csv read error: Column 32 not found in Row 2 #979

Description

@GreweStefan

Description

I have a 3rd party CSV file I´d like to process using MiniExcel.

0,"V","4000","6","26",10000001,"Test123" ,"220626",,1001200,,,5769.00  ,N,"EUR",,,,,,,        ,,,,,  ,  ,,,,,,,,,,,,0,
1,"V","4000","" ,"26",10000001,"Test457" ,"220626",,       ,,,5769.00  , ,""   ,,,,,,,0.00    ,,,,,"","",,,,
0,"V","4000","6","26",10000002,"Test789" ,"220626",,1104500,,,26550.00 ,N,"EUR",,,,,,,        ,,,,,  ,  ,,,,,,,,,,,,7,
1,"V","4000","" ,"26",10000002,"Test11X" ,"220626",,       ,,,26550.00 , ,""   ,,,,,,,0.00    ,,,,,"","",,,,

I use:

var csvConfig = new CsvConfiguration();
csvConfig.AlwaysQuote = true;
csvConfig.NewLine = Environment.NewLine;
csvConfig.ReadEmptyStringAsNull = true;
csvConfig.Seperator = ',';
csvConfig.FastMode = true;

List<dynamic> rows = null;
var result = MiniExcel.Query(
                    path: csvFile,
                    excelType: ExcelType.CSV,
                    configuration: csvConfig,
                    useHeaderRow: false);
 rows = result.ToList();

The "ToList()" crashes for me with

Csv read error: Column 32 not found in Row 2" | MiniExcelLibs.Exceptions.ExcelColumnNotFoundException

Expected Behavior

Have an option to specify a value for missing values or have a possibility to somehow process the file.

Actual Behavior

An Exception is throws that prevents processing.

Workarounds

none known

Environment (please fill the following information):

  • MiniExcel Version: [e.g. 1.45.0]
  • .NET Version: [e.g. net461]
  • OS: [e.g. Windows]

example.csv

Edit: fixed sample Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions