Recently, a user asked me to automate a process where she received an email with an Excel attachment. She needed to grab data from that attachment and put it into a different spreadsheet. This should have been a super easy task, but the attachment was in .xls format (Microsoft 1997-2003). We couldn’t change the format, and apps DO NOT play well with this format. So, I used Power Automate Desktop to convert it. Read on to learn how to convert xls to xlsx with Power Automate Desktop.
This super simple solution only involves two actions. But, I thought it worthy of a post because my first attempt at it used lots of actions, including a whole lot of send keys. Fortunately, I realized a much simpler solution was available.
The Simple Solution
My simple solution uses two actions.
- Launch Excel
- Close Excel
My flow also includes 2 input variables that Power Automate populates. (I call this PAD flow from Power Automate). The variable excel is the file path of the .xls file. The variable date is a date that I want to include in the new file name.
Action Details
I tell the action to open a document using the variable and to make the instance (of Excel) visible.
Then, I tell PAD to close the instance of Excel but to save it as a different file format and with a different name. I insert the date variable into the file name.
That’s it! Super easy. In two actions, I converted an Excel file from .xls to .xlsx. And, just in case you are wondering….
Error Handling
Since starting with Power Automate Desktop, I’ve learned good solutions include error handling. So, what happens if the file doesn’t exist? At first, I had trouble with this type of error, so much trouble that I posted in the Microsoft Community for help. Fortunately, PAD has an action to deal with the problems I encountered. I just didn’t know it existed. The action is called If file exists, and I bet you can guess what it does.
Now, I’m sure you noticed this flow differs from my flow above. That’s because my flow matured quite a bit while drafting this post. But, it is the same flow with the same basic Launch Excel and Close Excel actions. I improved the flow by creating subflow called Error_Report with specific tasks in the event of error, like Take Screenshot and Send Email. I also added an On Block Error action around the entire flow. In summary, if the file can’t be found, run the Error_Report subflow. If anything else goes wrong, run the Error_Report subflow.
If you’re unfamiliar with On Block Error, it is a fantastic action with a start and an end that wraps around other actions. When a PAD error occurs, it runs a subflow.
Convert Files in Bulk
Now, you may be asking the question – what if I need to perform this process on multiple files? After all, this example only converts one file. Well, I am fairly certain you can convert multiple files by adding a Loop action. I’ll try this out and post results in a follow-up post.
That covers it for this post. Now you know how to convert xls files to xlsx using Power Automate Desktop.
Other Power Automate & Power Automate Desktop Content
- How to Update an Excel File with Power Automate Desktop
- I am just getting started with Power Automate and Power Automate Desktop content. More coming soon!
Pingback: Trigger Alteryx Workflows With Email » The Analytics Corner
Pingback: Extract Numbers from a String in PAD » The Analytics Corner
Pingback: Getting Oriented with Power Automate » The Analytics Corner
Pingback: Combatting File System Frustration in Power Automate » The Analytics Corner
Pingback: Power Automate Corrupts Excel File Contents » The Analytics Corner
Hello there,
Does this also apply when trying to open xlsx file to xls. I ‘ve been having difficulty in opening xlsx file to xls, it kept giving me an error saying “file is corrupted, file not valid, must verify”.
Power Automate does not play well with .xls. I don’t think it will open a .xls file at all. I hope that answers your question. It should open .xlsx.
Power Automate didn’t convert .xls to .xlsx.
Without more information I don’t know what to tell you.
Then why the heck did you create this post? It doesnt do the very thing you said it will do CONVERT xls to xlsx. Without opening xls how the heck will you convert it??
It does convert…..not sure what you mean.
Pingback: How to Fix the 'Failed to Assume Control of Chrome' Error in Power Automate Desktop » The Analytics Corner
Pingback: How To Search PDFs for Keywords in Power Automate Desktop » The Analytics Corner
Pingback: The Power of OCR in Power Automate Desktop » The Analytics Corner