Copy excel sheets

Hi all,
I have a excel with 2 sheets and with different headers, I want to copy 2nd sheet data to 1st sheet and delete the 2nd sheet.

How to proceed with this.

Thanks in advance

@hanviprebday

If the same exact columns are present in both sheets but different locations, you can read range Sheet 2 and rearrange to match the columns of Sheet 1: How to change the datatable column sequence

But if the columns are totally different, you can remove some of the columns of the Sheet2 DataTable first, rearrange and then paste onto the Range once the transformation is complete.

Thanks!!

Can you be bit more clear

@hanviprebday Can you share what the columns of Sheet1 and Sheet2 are?

Sheet1 has 6columns From date, to date, from time, to time, number and narratives
Sheet2 has 5columns From date, to date, from time, to time and number
Now I want to copy sheet 2 data to sheet 1 and delete sheet2

@hanviprebday Thanks!! Here’s what you can try:

  1. Use Excel Application Scope and use the target file
  2. Use Read Range for Sheet2 and output to DataTable dtSheet2
  3. Remove the last column with Remove Data Column
  4. Paste the dtSheet2 datatable to the Sheet1 range with Append Range activity

Hope this helps

I don’t want to remove any column I want to keep the last column as it is

Hello @hanviprebday
Do read range from both sheet. loop the second datatable for each row inside loop keep one add data row activity. and give fist table name. use array property. append the array item which is null as emptystring. at last write on sheet one again. ar you can create array as {if(currentRwow(“ColumnName”).tostring,…, " "}-- last column value as blank or space
hope this helps

@Shubham_Kinge can you show in a flow if possible

@Shubham_Kinge can you please help me with the flow

@hanviprebday
Ya okay bro. sorry i was little busy with interview. wait 2 min ill give…

@hanviprebday




Here is the sample
hope this will solve your query

Alternative is ---- Modern Activity---- @hanviprebday


and again use use excel file again and use delete sheet activity by providing sheet name.

@Shubham_Kinge thank you it worked

But how to delete sheet I don’t have delete sheet activity


CHeck Modern. it should use under use file

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