Data from Screen Scraping is inputed into one cell in excel instead multiple rows

Hello,

Apologies for newbie problem/question and hard to understand explaination.

Basically i have collected data from web using Data Scrapping, assigned it to DataTable variable and then by using “Write Range” saved into excel.
The problem is that UiPath saving everything to the one excel cell (default A1). My data is like below:

BMW - 100
AUDI - 200
FIAT - 300

and it is all saved in to the one cell in excel, when i would like to have saved as

Column 1 Column 2
Row 1: AUDI | 200
Row 2:FIAT | 300
Row 3: BMW | 100

Please help, and disregard post “quality”

Hello,

Assuming you can’t find a way to directly generate the DataTable as expected from Data Scraping, you can solve the problem after you have the DataTable with all info in one column.
Build another DataTable with 2 columns, the use a For Each Row loop and do a string split on each row Item, and this resulting array you will add to the second DataTable as a row.
After you write range in excel of this second DT.
I have attached an example.
DataScraping.xaml (11.3 KB)
DataScrapeTest.xlsx (8.4 KB)

1 Like

Sounds like your Data Scraping is not set up correctly and is pulling everything into one column/row. Show us your Data Scraping activity, its properties, and the result of the test window.

Okay i have done with MarinAlexandru method and now i have error:
“Input Array is longer that the number of columns in this table”
Trying to prompt on message box the value its just: system.string which suggests i have done something wrong. I would like to share the projekt like you did in .xaml file but i dont have that option. is this because im using Community version? How can i show my projekt guys?

Main.xaml (15.1 KB)
Guys attached my xaml file. Could you help please, why its not working? :frowning:

Hi Bro.

If your data syntax as below…then you can use regex to extract letters or numbers only.

Such as: BMW - 100

Extract the letters only :
YourString = System.Text.RegularExpressions.Regex.Match(“Your Variable”, “^[a-zA-Z]+”).Value.Trim => Return: BMW

Extract the number only :

YourString = System.Text.RegularExpressions.Regex.Match(“Your Variable”, “\d+”).Value.Trim => Return: 100

1 Like

Pls check in attached file.

I have changed something

  1. Must be split row by row from datatable which you got from webpage
  2. Add them into the new datatable
  3. For each row to extract Letters and Numbers
  4. Write into the excel file
    File.zip (258.0 KB)
1 Like

You Guys, are true heroes. Heroes i do not deserve. Thank you very much all for help. Brilliant job!

Hi @Add_Bddd ,

Key points to remember when we do data scrapping -

1 - Try to put scrape data in notepad.
2 - Use generate data table activity and paste that notepad data and do preview.
During preview if you see data in single column try to use separators from the right side property of Generate data table window.
Once you do some work on it and finally it changes to rows and columns that you take it in data table.

Good if you know this already.
Thanks.

Noted Sir,

Did not know ( still learning stuff ) so appreciate solutions!

1 Like