Hi all,
I have a list of names, which need to be written in a single cell, how do I write all the names in single cell in a row? tried using String.join(",",finalArray) not successful
Hi all,
I have a list of names, which need to be written in a single cell, how do I write all the names in single cell in a row? tried using String.join(",",finalArray) not successful
What error you are getting with this,
There is no error, but its writing all the values by appending the cells, its not appending in the same cell by comma
Using the String.Join(“,”, finalArray) will join the array items in to string with commas, you have to hold this value in string variable and have to use write cell activity with the string variable to write it in the excel.
If it is possible share your XAML here.
You can directly append the value into one single variable and once all the value is updated you can right that variable value into particular cell.
Hi Rashmi,
this wouldnt work for a dynamic array right? my list may sometimes contain 3 names or five or 10 names cos im extracting those names from a PDF
You can use Rashmi’s solution by doing a for each and assigning :
This will produce :
Then Remove the first character so you don’t have the separator as the first character :
And now you’re good to go :
However I don’t think the problem comes from the string.join as mine worked just well.
Can you show us how you’re doing the write cell activity?
Hi,
I have attached my sample xaml,
Im trying to get approver name from pdf’s and then write it to excel. so the pdf may contain many names, so im collating all into a list, then trying to write the entire list in one cell .
ive attached the excel as well, below approver name for each row/cell many names must be written. this is my requirement
unilever2.xaml (36.8 KB)
testsheet1.xlsx (11.5 KB)
ive shared it bro, please check below
Try this workflow, you can add items to the string list inside a loop which you are extracting from the PDF.
StringJoin.xaml (6.4 KB)
my issue is the number if names is dynamic, here you have taken four values right, what if i dunnno the number of values present in the dynamic list.
can you please go through the workflow attached above?
The two methods presented to you work very well with dynamic arrays.
My guess is that your problem is that you’re adding to the collection AND writing in the cell AND incrementing the cell number all in the same sequence.
Your problem is the fact that in order for string.join or the for each method to work you need to FILL the array/list will all the elements and THEN write into the cell.
What is your output. You’re saying that it is writing all the values by appending the cells. Can you show us that?
If i’m right about this all you need to do is get out the write cell part from the for each row.
Disclaimer : I may be wrong also
@shreyaank i have made the change, check the workflow below.
StringJoin.xaml (8.0 KB)
Query raised by @shreyaank. Not by me please.
@sarathi125 sorry bro for the inconvinience caused for you
Hi Manjuts,
Here you have taken value 1 ,value2, value 3 and value 4, My scenario is that I wont know how many values would be there each time the list is extracted… Somtimes the list may contain 1 name, or sometimes 5 names…so how to deal with that when I’m joining them?
@shreyaank my file work for any length of list.
Can you pleaswe reveiw my xaml ? I just want the all the approver names to be in a single cell spearated by a commaunilever2.xaml (36.8 KB)
@shreyaank I have edited you workflow. check it once and let me know.
unilever2.xaml (36.8 KB)
Thanks man, it worked. I had to add another step to verify if the cell was empty before writing and then give Write cell activity and append.