Getting error CsvHelper.MissingFieldException: 'Field at index '82' does not exist. #2298
Unanswered
sumitshekhar41
asked this question in
Q&A
Replies: 1 comment
-
You would get this error if you were missing a field in your row that CsvHelper was expecting to be there. In the following example, in the 4th row it is missing a comma after "Bill", so there is no void Main()
{
var data = @"Id,FirstName,LastName
1,Tom,Jones
2,Jenny,Adams
3,Bill
";
using var reader = new StringReader(data);
using var csv = new CsvReader(reader, CultureInfo.InvariantCulture);
var records = csv.GetRecords<Foo>().ToList();
}
public class Foo
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When I am processing less records(2) in csv, its processing, while I am increasing number of records, I am getting following error
CsvHelper.MissingFieldException: 'Field at index '82' does not exist. You can ignore missing fields by setting MissingFieldFound to null.
IReader state:
ColumnCount: 0
CurrentIndex: 82
HeaderRecord:
IParser state:
ByteCount: 0
CharCount: 4096
Row: 4
RawRow: 4
Count: 82
RawRecord:
Beta Was this translation helpful? Give feedback.
All reactions