Concatenating data from extract table data activity

Hi, All i am lost on how to edit the data extracted from the Extract Table Data activty. Currently the activity is able to extract the data as such,
HS3
HS4
HS5 and so on…
However the problem is i need the data to be reformatted such that instead of multiple rows as shown, the data pasted onto excel is merge into one single row and thus one column like this : HS3,HS4,HS5 seperated by commas. How do i go about doing that? My data is a mixed of numerials and letters.

I have tried using methods like for each row activity and initializing a dictionary to store them but to no avail as i am not very proficient in Ui path at the moment.

Screenshot of potion with the problem

Hi @kiat.t

Can you try like below

1. Assign Activity
   combinedString = String.Join(",", extractedDataTable.AsEnumerable().Select(Function(row) row(0).ToString()))

2. Write Cell Activity
   WorkBookPath: "YourExcel"
   SheetName: "Sheet1"
   Cell: "A1"
   Value: combinedString

Cheers!!

Hi @lrtetala , thanks for the help. However the bot pasted the entire code in the excel file instead of the data. Could it be due to a variable type issue?

@kiat.t

Can you try to use the below syntax in assign activity print it in message box and check and please check is your datatable output is extractedDataTable variable

combinedString = String.Join(",", extractedDataTable.AsEnumerable().Select(Function(row) row(0).ToString()))

Hi @lrtetala, once again thanks for the suggestion. I replaced the “extractedDataTable” portion to the variable Datatablzz which is where the extracted data is stored.However the bot still repeats the same mistake.

@kiat.t

Can you please print the combinedString variable in message box and show us the Write cell activity

@kiat.t

For example

Input:

image

Output:

Regards,

Hi @lrtetala, i copied pasted the code you’ve generously provided and replace it with my datatable variable as shown. However the same problem still surfaces.

@kiat.t

Can you show your write cell activity because in the variable it is showing Datatablzz but in excel it is showing DataTable

Sure @lrtetala . Here is the portion of writing the data

@kiat.t

Have you tried to check the combinedString output in message box

@lrtetala
how do i do that?

@kiat.t

@lrtetala . This is the results of the message box. I am not sure why it displays datatable when i inputted the variable Datatablzz instead.

@kiat.t

Can you share your workflow screenshot

Regards,

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