CSV Read Error

Hi Team,

I have a csv file, when i try to use “read csv”, I am getting error - “csv file format is invalid”.
This CSV will have data starting from 3 rd line(column header), First two lines are not to be read as well. Please check the screen shot below


If I delete the first 2 lines and try “Read csv”, its fine but this file is from a mail. Please suggest me how I can handle this,

Is there any way I can read from line 3 or any easy way to remove first 2 lines before I read data?

Unable to attach csv so not sending the sample file, refer the picture for the column and the way data is written


Can you try the following steps?

  1. Read the file to string variable (say strData) using Read Text File Activity
  2. Delete first 2 lines using Replace activity with the following settings
    Input : strData
    Pattern : "^.*[\r\n]+.*[\r\n]+"
    Replace : ""
    Result : strData
  3. Read strData to DataTable type variable using Generate DataTable Activity with CSV Parse option.


1 Like