# Split text and create a datatable

**URL:** <https://forum.uipath.com/t/split-text-and-create-a-datatable/146596>\
**Category:** Help\
**Tags:** system, uiautomation, activities\
**Created:** [August 30, 2019, 9:11am UTC](https://forum.uipath.com/t/split-text-and-create-a-datatable/146596 "2019-08-30T09:11:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sdc](https://avatars.discourse-cdn.com/v4/letter/s/779978/32.png) [@sdc](https://forum.uipath.com/u/sdc)\
**Post date:** [August 30, 2019, 9:11am UTC](https://forum.uipath.com/t/split-text-and-create-a-datatable/146596/1 "2019-08-30T09:11:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![David\_Gunnarsson](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/david_gunnarsson/32/63415_2.png) [@David\_Gunnarsson](https://forum.uipath.com/u/David_Gunnarsson)\
**Post date:** [August 30, 2019, 9:15am UTC](https://forum.uipath.com/t/split-text-and-create-a-datatable/146596/2 "2019-08-30T09:15:47Z")

</div>

Hi sdc,

You could try using the action “generate datatable”

---

<div class="post-metadata">

**Author:** ![jitendra\_123](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/jitendra_123/32/44340_2.png) [@jitendra\_123](https://forum.uipath.com/u/jitendra_123)\
**Post date:** [August 30, 2019, 9:19am UTC](https://forum.uipath.com/t/split-text-and-create-a-datatable/146596/3 "2019-08-30T09:19:15Z")

</div>

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
