java.lang.IllegalArgumentException: Index for header ‘XXX‘ is 1 but CSVRecord only has 1 value

Java, error in importing CSV file.

Error locating to the following code

This is a simple string array, value. Consider the reason for the error.

The data of CSV is as follows:

Xiao Ming, 1,2,3

Xiao Li, 3,4,5

If the separator of your CSV file is different from the one set by your program, this error is likely to occur.

solve:

Read More: