Help needed - FOR LOOP does not seem to be reading all rows in excel

I’m till fairly new to UiPath and I have a used case to

  • read data from 2 separate excel files
    *store each column as a variable and use the variable names to write datarows (with a little formatting added while writing final string.

After writing out my final string, only the last record from the patient number col was been pulled. see below
finaloutput

this is the excel file I’m puling from
excelfile

The below is what the work flow should achieve

here is my workflow file
excelIssue.zip (17.9 KB)

Hi,

Can you try as the following sample?

excelIssue.zip (17.8 KB)

Regards,

1 Like

@Yoichi Thank you .That worked and I will mark it as the solution. I have one more question. Let say the Patient Numbers are in a .txt file. What will be the best approach to read them and use them as we did in this use case?

Will reading them to a datatable, the looping over the datable, and then writing them to excel work?

You don’t loop over the datatable and write each row to Excel. You use Write Range or Append Range and give it the whole datatable to be written in one step.

1 Like

@postwick I was talking about say you have a type , for ex ("1,2,3,4,5) and you wrote that to a text file. Then you store that in data table. Then write from dt to excel.
What is the best way to split the and then assign to a DT column?

What is this supposed to be?

Anyway you don’t write to text, then read text to datatable, then write to Excel.

I suggest…

1 Like

Thanks I will check that out. Essentially this is what I was trying to say:
Given an array of string : {“1”,“2”,“3”}
Then you read this string array into a DT
In your DT, you have a column name say patNum.
You want to achieve a use case where you have splitted your String : {“1”,“2”,“3”} and the final outcome is something like this:
image

  • For Each in {“1”,“2”,“3”}
    ** Add Data Row with ArrayRow {currentItem}
1 Like

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