Need an example on Comma Separator or using split function

Hi All,
I need an example workflow on comma separator using split function.

Scenario is like. i have an excel sheet with 3 columns and 5 rows . now i need to split these data’s using comma separator. please if you have any workflow example share me or is there any logic on split function how to do please tell me .

Hi,

use excel application scope and read range activity to read the excel data as a datatable.
Then use for each row activity and inside that for each column if you want to split use the following in an assign activity.

row(0).Split(New Char() {","c})

This will return a string array. You need to declare a variable and use it.

1 Like

Hi @sarathi125 I’m getting Array index out of bound exception. i have attached my excel sheet and workflow can you please check it where i have done wrong. i’m trying to display all the data in excel sheet. Main.xaml (11.5 KB) Test.xlsx (8.2 KB)

Hi @Kiran_Bg,

You are getting all the row count of the data table and using that to read the excel column value.

As per the excel you have only 7 columns, but rows 9. so when you are trying to read row(rowCount) it refers to 9th column which is not available in the input data.

i need to fetch the data based on the count , because if i add extra columns in excel then i don’t need to change the code. What ever may be the column based on the columns or rows count i need to fetch the data

Then use dataTable.Columns.Count instead of rows count.
Do you want to get data extracted from each column in all the rows?

Yes , i want to get data extracted from each column in all the rows.

i have tried using datable.coulumns.count but same exception is coming .indexOutOfRange Exception. Please help me On this

Hi, Check this
Main (6).xaml (9.9 KB)

Column1,Column2,Column3
Row11,Row12,Row13
Row21,Row22,Row23

Do you need above as the output?

Hi Kiran,

You want to split or combine columns using comma?
Split is to get individual values of a already comma seperated string.

Please clarify your requirement.

Thanks,
Arun

hi @ArunVelaayudhanG my requirement is like this. Whatever may the columns and rows in excel sheet . I have to extract all the data from excel sheet and store it an single array or an variable. Then i have to pass this array or variable as a single argument i have to pass all these data to queues .
Because in future if i add extra column or rows in excel sheet, then i don’t want to change anything in my code.

hi @sarathi125 i have run this code but it displaying only first row , i need all rows and columns

Why Dont you try datatable to json format

@Dilip_Wakdikar Can you please elaborate how to do that

Download Uipath.Web.Activities
Take assign Activity
jsonobject = JsonConvert.SerializeObject(Datatable)

Hi @Kiran_Bg,

If you kindly share the sheet or screenshot of the same, it will be helpful to understand.

Thanks & Regards,
Apurba

Hi @apurba2samanta Please find the attached sheet and workflow .

Here i have extract data from excel and then i have to add all these data to queues from queues i have to fetch average value and store it in excel sheet.

Note : as of now the excel sheet has 7 columns but in future i may add 10 more columns at that i don’t want change my code.

Test.xlsx (8.2 KB) Main.xaml (11.5 KB)

Read Excel, pass DataTableVariable to the activity ‘Output Data Table’, Check the Output of this.

Hi @Kiran_Bg,

Do you want to get the average of all the numbers present in the excel sheet?

Thanks & Regards,
Apurba