How to import data from one excel file and put it in the desired column in another excel file?

I have data in an excel file.
Screenshot 2023-07-24 145628

I want to migrate data to a new excel file, having to sort the data of columns A->C, B->B, C->A.
Screenshot 2023-07-24 150743

Best Regrads

@Famui_Yanisa

You can read the datatable and then change the column position…

please check this on how to change column position

cheers

Do you mean copy data from column A to column A, B->B, C->C?

  • read in excel1 - read range without header - dt1
  • reorder the columns - dt2 = dt1.DefaultView.ToTable(False, {“Column3”,“Column2”,“Column1”})
  • append range to Excel2 - dt2

No, sorry for the confusion. I want to migrate data to a new excel file, having to sort the data of columns A->C, B->B, C->A.

Hi @Famui_Yanisa ,
I think you want to write column C in file1 to column Animals (A1) in file2, column B to A-Z, and column A to Column Number(C1)
You can
-use excel read range file1
-filter data to get column what you need keep
-use write range to file2
My in/out


My code


regards,

1 Like

@Famui_Yanisa

Please try the above method specified its exactly what you asked for I believe

cheers

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