It's exactly like with the CSV, but yes, you would want to have an Excel File (think of it as a template), where you would have either
1. An Excel file that has no data or formatting in it, in SharePoint or OneDrive.
-Then you will use the Copy Command Action to make a copy of it in the new location. You will then do everything you do above, except instead of writing to the CSV file data, you will write to a Table in a Sheet in the Excel you copied.
Forget copying for a second, to write to Excel the easiest based on what you have
-Iterate through Rows in Dataverse
-Have a Table in Excel, that has headers and 0-X rows already (if its a template, then you have 0)
-Use the Add Row to a Table action for Excel to write the data
The reason I said forget the copy part for a second was to explain....
-If you have a pre-created excel template, and you know the format of the data, then also add a Table with headers in the "empty" excel so that you do not have to create the Table in the Power Automate flow
-If you do NOT know what the Table will look like in advance because they can export any Dataverse Table to excel, then the additional thing you have to do is use the Create Table Action so that when you loop through the data it will have a place to write the data
-------Steps
Before looping through Dataverse Data
--Trigger Flow
--Create a Copy of the File you have in advance into another location. You can use Copy Actions, or you can use GetFileContent first, then use Create File and use the content from the previous GetFileContent to create the new file
--IF your file has a Table in it already
----Loop through your Dataverse data and use Add Row to a Table to write it to excel, since the file already has a Table in it, you can identify the columns etc at Design time
--If your file is just blank
----Use Create Table in Excel to specify the Table Name, Sheet, and Range and Column Headers
----Now iterate through Rows
-------Now because the Table is Dynamically Bound instead of Statically bound you will only see a property called item, instead of actual column names
-----------Here you will use a json structure { ColumnName: Value } where you create a Name/Value pair so it knows where to write the data
If you follow the above, either version depending on if you know the Dataverse Table in advance or not and if you put an EXcel Table into the file before hand or not, will decide if you statically bind or dynamically bind
Final
---Trigger
---Copy/Recreate the Template file
Optional(Create Table in Excel File)
---Iterate through Rows in Dataverse
-----Add row to a Table Excel Action
------Optional(use JSON to define the Item Property if dynamic Table binding as you created it in the Optional Step Above
------Or just match the Dataverse Column data to Excel file Table Column
Done
If these suggestions help resolve your issue, Please consider Marking the answer as such and also maybe a like.
Thank you!
Sincerely, Michael Gernaey