Copy upto Certain rows before a particular name comes

Hello guys,

I am facing a problem to copy and paste the required rows before a mentioned name.


In this case , I have to copy all the values from these two columns before “Part A complete”.

And, no. of data may be different in other scenarios.

The whole excel file look like this -
Test_For_Copy_before_specific_column.xlsx (8.9 KB)

Can you please help me??

Thanks & Regards,
Nirmalya Sarkar

Hi,

Use below steps to achive the requirement.

  1. Use excel file / excel application scope to open excel file by giving excel file path.

  2. Use lookup range activity to lookup the specific value in the excel cell we have to provide input what text we are trying to search. Output would be cell reference.

  3. Use copy paste range activity and copy range should be A1:B+Cellreference from above step and paste range or destination should be A1 of some other sheet.

Please try and let us know. Thanks.

Hi @nirmalya.sarkar

Please try this,

  1. Read the excel data and store it in a datatable, variable name dt.

  2. Use the query and store the output in a datatable ,variable name dtResult

dt.asenumerable.takewhile(function(row) not row("Sr. No").tostring.trim.equals("Part A complete"))
  1. Write the data back into the excel using write range activity.

Thanks

@prasath_S ,

You mentioned about datatable . So, what datatable activity should i use ??

Can you please tell me?

Thanks & Regards,
Nirmalya

@nirmalya.sarkar .

Please use read range activity, it will store the excel data into a datatable

After that use assign activity and give the query I gave in previous post and save to a datatable variable

Lastly use write range activity and Write the data onto the excel file.

Thanks

@prasath_S ,

I have stored the data and used an assign activity “dtresult” and set the datatype of this variable as “Datatable”.

But it gave some following error-

Can you guide me??

Thanks & Regards
Nirmalya

@nirmalya.sarkar

Please try this,

dt.asenumerable.takewhile(function(row) not row("Sr. No").tostring.trim.equals("Part A complete")).copytodatatable

Thanks

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