How to read CSV properly?

Hello,

The structure of the .CSV file is as follows:

image

image

When I use “Read CSV” the error is shown: invalid format.

Please, how could I do it?

Thanks a bunch.

1 Like

Hello, EngAnalyst.

It seems that there is unnecessary row in your CSV.
Before we can read the csv file, we need to remove the first line of the csv.

To remove the first line, please follow the instructions below:

  1. Read Text File
    a. File Name: Full path of your csv file
    b. Content: variableName (let’s say strCSV as the variable name)
  2. Write Text File
    a. File Name: same as the above
    b. Input: strCSV.Substring(strCSV.IndexOf(vbCrLf) + 1)

Then after that, you can now read your csv file successfully :slight_smile:

Hope this helps.
Thanks and regards!

1 Like

Thank you very very much.

When I use “Write Text File”, the file is saved as “.txt”. How could I do to read csv?

Edit: Jan_Brian_Despi, when I write text file as “.csv” format and then I use “Read CSV”, the error again appears… (format invalid)

@ Jan_Brian_Despi I think that I see the problem.
The real input is as follows:
image
The symbol “;” appears at the end of every sentence (not just in the first row)…

1 Like

Hi @EngAnalyst,
1.You may use Read CSV activity and select the semi colon as delimiter as you file has semi colon as delimiter.READ CSV will work for semi colon.
2.If read csv not worked then use Read txt file activity and you will getting a string and you can use Generate data table for generating data table from string and writing in other sheet.
If you find this useful mark it as solution.
Cheers
Vashisht.