# How to split excel cell data dynamically?

**URL:** <https://forum.uipath.com/t/how-to-split-excel-cell-data-dynamically/527934>\
**Category:** Studio\
**Tags:** stringsplitoptions, activities-panel, question, studio, excel, uiautomation, activities\
**Created:** [March 21, 2023, 6:00am UTC](https://forum.uipath.com/t/how-to-split-excel-cell-data-dynamically/527934 "2023-03-21T06:00:20Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vaishnav\_Tej](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vaishnav_tej/32/268468_2.png) [@Vaishnav\_Tej](https://forum.uipath.com/u/Vaishnav_Tej)\
**Post date:** [March 21, 2023, 6:00am UTC](https://forum.uipath.com/t/how-to-split-excel-cell-data-dynamically/527934/1 "2023-03-21T06:00:20Z")

</div>

Hi Community,

I have this data in excelrows

 ![image](https://global.discourse-cdn.com/uipath/original/4X/b/5/a/b5a83897fe50345cf8cbebd4709aa5a8704db472.png)

I have to get the values of A and B dynamically.( Excel Values may differ.)  
And update the values in the portal in respective fields.

**Example1 :** If this is the portal having fields A, B, A and input value is  
**A-20,50 B-300,400** then it has to enter data in below format  
 ![image](https://global.discourse-cdn.com/uipath/original/4X/1/c/c/1ccd890a84e0473526808a332a614a0904332de7.png)

**Example2 :** If portal is having fields A, B and input value is **A-20 B-300** then it has to enter data in below format  
 ![image](https://global.discourse-cdn.com/uipath/original/4X/f/2/6/f26769e951d54d14013c5346d816402bc50bb5b0.png)

**Example3 :** If portal is having fields A, A, B, A and input value is **A-20,50,55,77 B-400**  
then it has to enter data in below format  
 ![image](https://global.discourse-cdn.com/uipath/original/4X/9/3/0/930f39a0f25c6b27ef994aeb64cbc90f66e62bef.png)

So the fields in the web page are dynamic and also excel data is dynamic.

Can someone please help me with the logic.

Thanks in Advance:-)

---

<div class="post-metadata">

**Author:** ![Jithesh\_R](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/jithesh_r/32/375562_2.png) [@Jithesh\_R](https://forum.uipath.com/u/Jithesh_R)\
**Post date:** [March 21, 2023, 6:21am UTC](https://forum.uipath.com/t/how-to-split-excel-cell-data-dynamically/527934/2 "2023-03-21T06:21:11Z")

</div>

Hii @Vaishnav_Tej ,  
Please check this workflow and let us know this is your required output.

[ExcelAutomation.zip](https://forum.uipath.com/uploads/short-url/coP8aZQ5taUYA6wYeDofTH9ZcbR.zip) (2.5 KB)

Input:  
 ![image](https://global.discourse-cdn.com/uipath/original/4X/1/8/c/18c1461918a6aea1e87eec06c077cc7c553fc5a7.png)

Output :  
 ![image](https://global.discourse-cdn.com/uipath/original/4X/0/f/5/0f59acecc305df193b3e026785525fd2b4f2a52c.png)

Hope this helps,

---

<div class="post-metadata">

**Author:** ![supermanPunch](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/supermanpunch/32/133652_2.png) [@supermanPunch](https://forum.uipath.com/u/supermanPunch)\
**Post date:** [March 21, 2023, 6:27am UTC](https://forum.uipath.com/t/how-to-split-excel-cell-data-dynamically/527934/3 "2023-03-21T06:27:38Z")

</div>

> [@Vaishnav\_Tej](#):
>
> I have to get the values of A and B dynamically.( Excel Values may differ.)  
> And update the values in the portal in respective fields.

Hi @Vaishnav_Tej ,

It seems that you would require to re-arrange the values of the Excel to a different format.

Maybe you could try the below steps :

1. Prepare an Output Datatable using `Build Datatable` activity having two columns, Preferably String or Object types. Let’s name it as `OutputDT`.

2. We can then use the below Expression to get the data in a Table format as required :

```auto
OutputDT = (From s In DT.AsEnumerable.SelectMany(Function(x)Split(x("Your Column Name").ToString)).toarray 
Let firstValue = Split(s,"-")(0).ToString 
Let secondValueArray = Split(Split(s,"-")(1),",").ToArray 
From val In secondValueArray 
Select OutputDT.Rows.Add(firstValue,val)).CopyToDataTable

```

Here, `DT` is your Datatable from Input Excel, You would need to provide the proper column name in place “Your Column Name” in the expression which contains the values to Split.

Let us know if you were able to implement this.

---

<div class="post-metadata">

**Author:** ![Vaishnav\_Tej](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vaishnav_tej/32/268468_2.png) [@Vaishnav\_Tej](https://forum.uipath.com/u/Vaishnav_Tej)\
**Post date:** [March 21, 2023, 7:09am UTC](https://forum.uipath.com/t/how-to-split-excel-cell-data-dynamically/527934/4 "2023-03-21T07:09:56Z")

</div>

Hi,

Thank you for your workflow. I’m able to fetch the values but actual rewuirement is I need to enter those values in the WebPage portal. How can i do that dynamically?

As I cannot share Web Page screenshot due to confidentiality, I have shown you in the example how the page will have dynamic fields on every entry.

Please refer my examples and help me please.

---

<div class="post-metadata">

**Author:** ![Jithesh\_R](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/jithesh_r/32/375562_2.png) [@Jithesh\_R](https://forum.uipath.com/u/Jithesh_R)\
**Post date:** [March 21, 2023, 7:20am UTC](https://forum.uipath.com/t/how-to-split-excel-cell-data-dynamically/527934/5 "2023-03-21T07:20:11Z")

</div>

Hii @Vaishnav_Tej ,  
I have one query, I just wanted to know in the webpage how many slots will be there to update the values of A and B.  
If only one each is there for A and one for B,’  
then how you want the result of A to be printed because in the output if your input is like  
A-20,50 B-300,400  
Then your output will be  
A 20  
A 50  
B 300  
B 400  
You want me to add all the values of A aswell as B or You want me to Type the values seperately?

---

<div class="post-metadata">

**Author:** ![supermanPunch](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/supermanpunch/32/133652_2.png) [@supermanPunch](https://forum.uipath.com/u/supermanPunch)\
**Post date:** [March 21, 2023, 7:24am UTC](https://forum.uipath.com/t/how-to-split-excel-cell-data-dynamically/527934/6 "2023-03-21T07:24:44Z")

</div>

> [@Vaishnav\_Tej](#):
>
> If this is the portal having fields A, B, A and input value is

@Vaishnav_Tej ,

Additionally let us know how the fields are presented in the portal, Is it available in a Tabular format ?

We should be able to identify the field names at first either by performing Table Extraction and get the data or by using Find Children activity and get the list of fields.

Then according to this data, we can filter the Resultant Output we have created accordingly and then enter the data into the portal.

Let us know some more details of the representation of the Fields in the portal.

---

<div class="post-metadata">

**Author:** ![Vaishnav\_Tej](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vaishnav_tej/32/268468_2.png) [@Vaishnav\_Tej](https://forum.uipath.com/u/Vaishnav_Tej)\
**Post date:** [March 21, 2023, 8:14am UTC](https://forum.uipath.com/t/how-to-split-excel-cell-data-dynamically/527934/7 "2023-03-21T08:14:01Z")

</div>

For Eg. Consider this excel  
 ![image](https://global.discourse-cdn.com/uipath/original/4X/c/2/7/c27b333069f598d0bd34c2bea379eac1b8511163.png)  
P1 has 4 lines  
P2 has 2 lines  
P3 has 5 lines

And this is the WebPage. Here 4 lines are there. So it should consider Product P1  
**A-20,50 B-300,400**

**FYI- A means Discount and B means Net Price**

As shown in the screenshot it has to enter respective values

![image](https://global.discourse-cdn.com/uipath/original/4X/a/6/2/a6298cdb6f8b96e1d052159fcb564e3e2ccdb365.png)

---

<div class="post-metadata">

**Author:** ![Jithesh\_R](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/jithesh_r/32/375562_2.png) [@Jithesh\_R](https://forum.uipath.com/u/Jithesh_R)\
**Post date:** [March 21, 2023, 8:44am UTC](https://forum.uipath.com/t/how-to-split-excel-cell-data-dynamically/527934/8 "2023-03-21T08:44:55Z")

</div>

@Vaishnav_Tej ,  
I have updated my workflow according to your requirement.I have left select item and type into activity just by adding variable didnt indicate since the webpage is not available you can make the selectors dynamic and check.

[ExcelAutomation.zip](https://forum.uipath.com/uploads/short-url/vGaGBs5pJwtpTqOkc4s9wvpmGRH.zip) (3.3 KB)

Regards,

---

<div class="post-metadata">

**Author:** ![Vaishnav\_Tej](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vaishnav_tej/32/268468_2.png) [@Vaishnav\_Tej](https://forum.uipath.com/u/Vaishnav_Tej)\
**Post date:** [March 21, 2023, 2:08pm UTC](https://forum.uipath.com/t/how-to-split-excel-cell-data-dynamically/527934/9 "2023-03-21T14:08:35Z")

</div>

ok let me try. Thank you

---

<div class="post-metadata">

**Author:** ![Vaishnav\_Tej](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vaishnav_tej/32/268468_2.png) [@Vaishnav\_Tej](https://forum.uipath.com/u/Vaishnav_Tej)\
**Post date:** [March 23, 2023, 10:18am UTC](https://forum.uipath.com/t/how-to-split-excel-cell-data-dynamically/527934/10 "2023-03-23T10:18:55Z")

</div>

Can you help me with the logic on uploading the data to the webpage based on no. of lines ?

---

<div class="post-metadata">

**Author:** ![Jithesh\_R](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/jithesh_r/32/375562_2.png) [@Jithesh\_R](https://forum.uipath.com/u/Jithesh_R)\
**Post date:** [March 23, 2023, 11:49am UTC](https://forum.uipath.com/t/how-to-split-excel-cell-data-dynamically/527934/11 "2023-03-23T11:49:36Z")

</div>

@Vaishnav_Tej ,  
Sure

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [March 29, 2023, 6:32am UTC](https://forum.uipath.com/t/how-to-split-excel-cell-data-dynamically/527934/12 "2023-03-29T06:32:23Z")

</div>

Closed on March 29, 2023, 6:32am UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
