How to convert CSV to datatable?

Hi expert,

I have a question how to convert csv string file to Datatable.
I was thinking I can achieve it with read text & generate data table method, but I could only separate first line and other… (Row separator"," and Line sep “vbcrlf”, anyway)

If somebody has sample code or suggestion, please let me know…

Best regards,
Jumbo,

Hi Jumbo,

Check the Generate Data Table activity. There you can set the Column Separator and New Line Separator.

If still is not clear, please upload your CSV file, or just a sample of it, to provide you a better example.

1 Like

Hi @Silviu

Thanks for your reply, but I could not achieve it with below code.
The input csv file has 7 lines but the result was 5 line exported to datatable…


(UiPath forum does not allowed to attach text file, so please change this xaml file to csv as sample data. → SampleStockPrice.xaml (1.4 KB)
)

if you know something, please let me know.

Best regards,
J,

1 Like

Did you try Read CSV activity? If so, the result is the same as above? 5 lines in datatable?

4 Likes

Hi @vvaidya
Thanks for your comment, I was forgot about read csv activity and it worked!

But do you know why my csv did not properly separated with new column separator “,”? if you have idea, please let me know.

Best regards,
J,