Copy value from above row in excel


In my excel file I need to copy every blank row with a value above it.

Based on image below, I need to copy value “Adidas” to row ID-2 and so on.

My end result should be like this:

Anyone have any idea how to do this? The blank rows are random.

Hi @jenkim

Try this way

  1. Use read range to read the excel file and store in dt1

  2. Use for each row to loop through each row of dt1

Inside the for each row do the following, create a variable in the index property section let’s say index of for each row which store the row index of each rows through which we are iterating.

a. Put an if Condition with condition as row(“BrandName”).ToString.Equals(" ")

if the above condition is true


Use write cell activitiy to write the value at cell : “B”+(index+2).ToString

value as dt1.Rows(index-1)(1).ToString

In else section do nothing

Hope it helps you


Nived N :robot:

Happy Automation :relaxed::relaxed::relaxed:

1 Like

@jenkim - 1. Read the sheet and save it datatable called dt
2. For Each row of Dt
2.1 If Condition = row(“Brand Name”).ToString=Nothing
2.2 Assign row(“Brand Name”) = dt.Rows(dt.Rows.IndexOf(row)-1)(“Brand Name”).ToString

  1. Outside of For each Loop . Write Range = Datatable => Dt to the same sheet
1 Like

Check this below workflow, @jenkim
ExcelOps_UpdateCells.xaml (9.2 KB) and find input file also Forum_Test_File.xlsx (8.5 KB)

Hope this may help you :slight_smile:

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