Excel Update - Help

Hi, can anyone tell me Why i am getting this error.


Here, i want if the value not match in both the file then the first file value will replace the second file value. and if the given condition match then that row will get delete.

I am trying this but not working.Please Help
Test.xaml (10.9 KB)
Book1.xlsx (10.1 KB) Book2.xlsx (11.2 KB)
getting this error:
image

Hi @Anjali_Rani ,

While iterating on any collection (Table, Array, List etc), you cannot add or delete items to/from collection.

So in your case, if you’re trying to delete row while iterating, you can’t.

@Anjali_Rani

in addition to Shraddha’s input debug the flow and verfify that rowArray is not empty. With Access 0 you are trying to access the first element of an empty array. This looks like the exception is thrown

I am not recognizing the error? Please Check the Xaml file once what i shared.
Please tell where i am doing mistake.

Please help, please tell me where I am doing wrong.How can I achieve this:
if the value not match in both the file then the first file value will replace the second file value. and if the given condition match then that row will get delete.

Hi @Anjali_Rani ,
Which column are you referring to?

Hi,Thanks for asking,Please See this, We have to compare both the excel file ,If Arrival And Destination value will match in the both the excel then ignore that and if arrival and destination will not match then the column"value" of Book1 will get replace to column “value” of Book2.
Book2.xlsx (8.7 KB) Book1.xlsx (9.0 KB)

Hi @Anjali_Rani ,

Check this sample workflow & modify it as per your requirements. :slight_smile:

Also note that I’m using Name column as identifier for row so the values are distinct in this column.

Files:
Main.xaml (9.4 KB)
input.xlsx (9.2 KB)
output.xlsx (8.1 KB)


Hi,This is not loading.

hi, i am not able to load this,how can i access this?

Hi, I don’t have access to my machine currently. I’ll get back to you ASAP.

I’m iterating on dt_Input2. Then using Lookup Column activity on Name column to find that name row in dt_Output .

Then I check Arrival & Destination, if they don’t match I’m updating row of dt_Output.

I didn’t delete row of dt_Output if Arrival & Destination match. You can do it.

ok,But Please provide me that Xaml file again,Please asap.Thank you.

Hi @Anjali_Rani ,

Workflow (with all files):
sample.zip (138.7 KB)

Reference Screenshots:


For Each Row In Data Table Code:
ForEach
row in dt_Input2

Lookup Data Table:

  1. LookupValue = row("Name").ToString
  2. ColumnName = "Name"
  3. RowIndex = int_OpIdx

If Statement:
If (row("Arrival").ToString <> dt_Output(int_OpIdx)("Arrival").ToString) Or (row("Destination").ToString <> dt_Output(int_OpIdx)("Destination").ToString)

Assign - Value Column:
dt_Output(int_OpIdx)("Value") = Cint(row("Value").ToString)

Assign - Update Column:
dt_Output(int_OpIdx)("Update") = "Yes"
End Of For Each

Hope this helps you.

1 Like

Thank you so much.

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