
Announcements
Hi i am doing an automation of copying different data from one excel worksheet to another excel worksheet,i create more than 200 steps in this flow, because i need to copy eg. A1, A2 ,A3, A5, A7 cells to the new worksheet A1, B1, C1, D1, E1, F1 and then i copy C1, C2, C3, C5, C7 cells to A2,B2,C2,D2,E2,F2, and .....from column ACEGIK to ABCDEF then close and save this excel. How can I simplify this process? because I can imagine in the future once i insert one column to the excel, it is so difficult to update in that 200 steps........
Instead of using the Copy cells from Excel worksheet and Paste cells to Excel worksheet actions, use Read from Excel worksheet and Write to Excel worksheet. The Read from Excel worksheet allows reading a range. You can read the entire sheet at once into a data table variable. This means you will not need to switch back and forth between your sheets to copy values.
I can see that writing would likely still need to be done separately for each column, as you seem to be transposing your table there by writing a specific column into each row in the new sheet. But it would likely also be possible to build this dynamically, where you retrieve a certain column of your data table into a list by using the Retrieve data table column into list action and then use a loop on that to write it's values into a row in the new sheet.
-------------------------------------------------------------------------
If I have answered your question, please mark it as the preferred solution.
If you like my response, please give it a Thumbs Up.
If you are interested in Power Automate, you might want to follow me on LinkedIn at https://www.linkedin.com/in/agnius-bartninkas/