Convert value of type "System.Data.DataTable" to "String"

Hi everybody.

I was trying to follow the “Introduction to UiPath” video tutorial and got an issue when used the Data Scraping Wizard.

After extracting the datatable from the web page I was trying to write it in a *.txt file but got an error message “Cannot convert value of type "System.Data.DataTable" to "String".” (it’s in Russian on the screenshot).



I’ve found smth similar but as I far as understand I did this “ write text file * activity” mentioned there

https://forum.uipath.com/t/how-to-convert-datatable-to-string-value/20890

Can anybody tell me where I’m missing.

Thanks a lot.

Hello @alexK
if you want to write a datatable in text file you have to convert the data table to its string form you can do this using “output data table” Activity and then use its output to write in the text file

2 Likes

You can also just use the Write CSV with your data table. CSV files are comma-delimitted text files.

Thank you very much guys)
trying to pass further…
@reda I tried to use the “output data table” Activity and I can’t set the proper name for the output of this Activity in order to pass this output as the input for the “write text file” Activity. I scrolled the list of names given in Namespace option and selected several ones but every time got an error. I also created a new variable and used it but in this way I got an empty txt file.

ok @ClaytonM’s method is actually better,
but if you want to do as I said you have to create new string and then use it as the output in the activity output data table

1 Like

Thanks a lot
Don’t have an opton to create a CSV file. Probably I have to istall some additiional package but don’t know yet which one i need.
I’ll find out
Thank you

I still recommend Write CSV, but sometimes you do need to use Write Text File, and you can actually store the text to a CSV file through that activity.

image

So you can use that after the Output Datatable
Then, you can open the file in Excel too.

Can you give more details ???