Error in Reading CSV file

Hi
I am downloading a csv file from a web page but couldn’t able to read.
Read range throwing error.

Here is the error:

RemoteException wrapping System.Exception: The CSV file format for resources\Test-download.csv is invalid
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)

Kindly help

Hi,

Probably there is different from numbers of column in each row.
Can you check and fix it?

or can you share your csv file?

Regards,

There is no diffn no of columns. I can’t share exact file will try to share similar one

1 Like

downloadFikterTest.zip (8.5 KB)

Pls check it and tell

@Palaniyappan

New Text Document.zip (180 Bytes)

Atleast this is also not working
o/p dt is null

@KarthikBallary Most Probably the Data in CSV file is not Actually in CSV Format. If you open that File in Notepad, you’ll notice that SL.No and Name are in the Same Column that are separated by tab and also Double Quotes are surrounded. This might be the cause of Read CSV not recognizing the file. If you can correct this format, it would be good. Else we would need to apply some other methods to convert it to a proper CSV.


Is this becoz of this

Thanks How to crct this format or other mehod…pls help

Hi,

In my environment, Read CSV can read both “downloadFikterTest.csv” and “New Text Document.csv” without error.
Do you have any error in reading these csv file in your environment?

Regards,

I am geeting either file name is invalid when delimeter is set to comma
or null if delimeter is set to tab

Hmmm…

There is another approach to read csv file. 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.

  3. Now, we can get datatable like using read csv.

Regards,

1 Like

okay Thank you so much

In generate data table I get only column separartor options by tab, space, new line. But it was better if it was comma. And if I select tab…some rows getting dstrubed

what if some are separated by tab and comma

This is not working for me

Generate dT has no comma separator option

Hi,

You don’t need to use wizard. The following image is settings for parse comma separated format to datatable. Can you try?

Regards,

works fine thanks.

But I have one more issue. Before headers have some description part how to remove it?
if split string—strVar.remove(0, Split(strVar,EnvironmentVariable.newLine)(0).length)
will show empty dt