Getting an error while reading csv "Line 2 contains more values than the header line". Moreover it is getting opened up manually without any issue

I am getting below error while reading a csv file. file can’t be modified as there are large number of files.

Source: Read CSV

Message: The CSV file format for C:\Users\masoni\Desktop\New folder (4)\2021\April\341465-000-Enrollment Report - 04-02-21 To 05-01-21 - 18 113129.047_Participant_Count_14.CSV is invalid. Line 2 contains more values than the header line.

Exception Type: UiPath.Excel.CsvParseException
RemoteException wrapping UiPath.Excel.CsvParseException: The CSV file format for C:\Users\masoni\Desktop\New folder (4)\2021\April\341465-000-Enrollment Report - 04-02-21 To 05-01-21 - 18 113129.047_Participant_Count_14.CSV is invalid. Line 2 contains more values than the header line.
at UiPath.CSV.Activities.ReadCsvFile.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Hi,

Can you try the following steps?

  1. Read csv file as string using Read Text File activity.
  2. Generate datatable from the string using Generate DataTable activity with csv parse option and Use Column Header option.

Regards,

Yes its working thanks

1 Like