How to copy Particular Range of values based on some condition and Append/Paste in same sheet of Excel file

Hello guys!

I need to Copy Few Rows, and then Append it, to the same sheet based on some condition.
Could someone give a solution to this?

Regards,
Nidhi K

Hi

We can get the specific range using

  1. Select the range first
  1. Get the selected range as a string using
  1. Now use this range string as a input for RANGE property in READ RANGE activity which will give us datatable as output

  2. Then finally use a append range to add it to a excel

And use append range to append it to a excel

Cheers @nidhi.kowalli

@Palaniyappan

But Append Range takes , ‘Datatable’ as input variable!

1 Like

I have updated my previous comment
Pls check
@nidhi.kowalli

Did that work for you @nidhi.kowalli

Hi Nidhi,

I have attached a flow which will copy first two rows and append it to same sheet using VBA.

If you provide more details on what rows you want to copy and based on what condition you want to paste then I can modify VBA code accordingly.

CopyExcelRow.zip (15.4 KB)

Thanks,
Kapil

@Palaniyappan
Sorry! That did not work!

Let me try the other suggestion

@Kapil

Column: C4
Column Name: RRN
Value: Settlement
condition: IF “RRN” Equals or contains “Settlement” then Append those rows!

Hi Nidhi,

I have attached the flow. Incase the RRN column of excel contains “Settlement” text then the entire row will be appended in the end.

Kindly let me know if it addresses your requirements or any updates needed.

CopyExcelRow.zip (15.1 KB)

Thanks,
Kapil

@Kapil
Cool!
But how do I use this in my project?
M sorry, I really have no idea how to apply this to my project !!

Hi Nidhi,

Please follow below steps,

  1. Make you excel macro enabled. This will change extension of your excel from xlsx to xlsm. You can easily find in internet how to do it.

  2. Open Visual Basic Editor in your macro enabled excel and add module to it. These steps can also be easily found in internet.

  3. Update below code in your module. You can copy this code from module of excel in attached flow.

  4. Set columnIndex variable in this code as per index of your column. In my case RRN was 3rd column hence I updated it as 3.

  5. Set searchString as the string you are searching for. I believe it is “Settlement”.

  6. Close Visual Basic Editor.

  7. Drag Excel Application Scope activity and give path of your excel in it.

  8. Drag Execute Macro activity inside it and update “CopyPasteRow” in it. Run the flow.

Let me know if you face any issue.
CopyExcelRow.zip (15.6 KB)

Thanks,
Kapil

may I know what issue we were facing
@nidhi.kowalli

@Palaniyappan

There is neither any error , Nor any OUTPUT!!!
Flowchart1.xaml (11.9 KB)