Hi
I want to read the CSV file. I’m using the READ CSV activity but getting error
Error: “Read CSV: The CSV file format for Communication File\data.csv is invalid. Line 2 contains more values than the header line.”
I’ve attached the csv file below.
Yoichi
(Yoichi)
2
Hi,
Can you try as the following?
First, read csv file as string using ReadTextFile activity.
Next remove the first line of the string using the following expression.
strCsv = System.Text.RegularExpressions.Regex.Replace(strCsv,"^.*\n","")
Finally, convert it to DataTable using GenerateDataTable activity with CSV option.
Regards,
1 Like
neha.upase
(Neha Upase)
3
You can also try below steps
-
Read csv file as string using Read Text File activity.
-
Generate datatable from the string using Generate DataTable activity with csv parse option and Use Column Header option.
1 Like
I’ve tried this scenario and its working. In this case no need to use assign activity. Directly convert sting to DataTable variable easily.
Thank you!!
1 Like
system
(system)
Closed
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.