Split text and create a datatable

Hi guys,
this question has probably been asked hundreds of times but I didn’t find an easy solution that works for me.
My problem is: i have a web page where i have to extract data with screen scraping, after i have to split text and put in datatable.
data is a multiple rows text below an example:
id|odl|data|title|description|type
27464|602371666|24.08.2019|1M - test|see: 27464|2
so i have to split row data by “|” and put each string in column. Same for each row.
So my expectation would be a datatable with 6 columns and 2 rows with data.

How can I do this?
Thanks in advance for your time.

1 Like

Hi sdc,

You could try using the action “generate datatable”

Hi @sdc
I hope you are getting the String after that follow the following steps.

  • Build a dataTable Using Build data table Activity and create all columns which are required and save output in dt.
  • Split the data Using YourStrVar.Split(cchar("|")) this will give you array of string.
  • Then assign these values to variables using ArrayVar(0) Assign this to Id a string variable.
  • Do the same things to get other column values you just have to Increase the Index.
  • Use Add data Row Activity and provide all above variables in Array Row Like this {Var1,Var2,var3…}.
  • Use Write Range to write data from data table dt.
    Thanks & regards