Power Automate Create Excel File (Tutorial)

This quick tutorial shows you how to use Power Automate Desktop to create and save an Excel spreadsheet.

You’ll learn how to use Power Automate Desktop to:

  1. Launch Excel on your local machine
  2. Create a new Excel workbook
  3. Write content to a worksheet
  4. Close and save the Excel file to a specific location

Prerequisites

You will need these two applications installed on your local machine:

  1. Power Automate Desktop
  2. A version of Microsoft Excel

Video Walkthrough

If you prefer video, here’s the walkthrough of the contents of this article.

Using Power Automate Desktop To Create An Excel Spreadsheet

Launch Power Automate Desktop.

Add a new flow by clicking on the + icon in the top left of the window. Name your flow “excel_hello_world” and hit the Create button.

This image has an empty alt attribute; its file name is pad_create_new_flow.jpg

Finding and choosing the Excel actions

The left pane of the Editor shows all the categories of actions available to you.

You’ll find “Excel” in the middle of the list. Expand the category to see individual actions for controlling Excel.

We’ll be using three actions in this starter project. I’ve labeled them in order in the picture below.

This image has an empty alt attribute; its file name is actions_excel_category_expanded.jpg

The first action we’ll use is to launch Excel on your machine.

This action will launch a new instance of Excel, regardless if you already have a spreadsheet already open or not.

It’ll be less confusing for you now if you close any instances of Excel that are currently running.

Choose “Launch Excel”

Drag and drop “Launch Excel” into the Main window in the editor.

You will see a pop-up window that allows you further control over when Excel opens. For our tutorial, leave all the defaults.

This will result in Excel launching with a blank worksheet.

Now we want to do something useful with this worksheet.

Write to the worksheet

Drag and drop “Write to Excel worksheet” into the editor as the next action.

We’re going to keep things simple in the pop-up window.

I simply want to write “Hello World” into the first cell of the spreadsheet.

To achieve this, type into three input boxes:

  • Value to write: Hello World
  • Column: 1
  • Row: 1

Check the picture below to see exactly what we’re putting where.

Leave the other input boxes unchanged and click the “Save” button.

This image has an empty alt attribute; its file name is actions_write_to_worksheet.jpg

Testing what we’ve got so far

At this point, you can test what you’ve done so far by running the flow.

When you hit the play button in the top bar, keep an eye on the bottom taskbar in Windows. You’ll see the Microsoft Excel icon appear, as it is launched by your flow.

Unless you quickly minimize the PAD editor, you may not see the flow actually writing on the spreadsheet.

But you can switch from the editor to Excel and you should see what’s shown in the picture below.

This image has an empty alt attribute; its file name is test_open_worksheet_with_hello_world.jpg

I’ll call out two points.

This is a new instance of Excel with an unsaved workbook. So, the focus is on Sheet1 of Book1.

The second point is that “Hello World” has been written into the first cell of the worksheet. That is exactly what we specified.

We ran this flow without an action to close Excel. So the spreadsheet is left open for us to peruse. That’s quite useful to check that we’re on the right track.

But we do want to save the spreadsheet. So, let’s move on to add the final action.

Save and close the Excel file

Our final step is to save and close the file.

You’ll see an action under the Excel category for both “Save Excel” and “Close Excel”.

We could use both actions to save the spreadsheet first and then close it. But we can do what we need with a single action.

Drag and drop the “Close Excel” action into the Main flow.

The default parameters for this action are to close the spreadsheet without saving it. We want to change this!

Expand the dropdown for the closing parameter and switch to “Save document as”.

This image has an empty alt attribute; its file name is actions_excel_save_as.jpg

This will open two new parameters. The first allows you to set the extension. You can leave it as the default.

The second parameter lets you input a full file path and name (you don’t need to include an extension).

I set my document path to: “c:\users\public\hello_world”.

And that’s it!

What The Completed Flow Looks Like

This picture shows what your full flow should look like.

This image has an empty alt attribute; its file name is main_flow_completed.jpg

Run The Full Flow

When you click the run button, you’ll be forgiven for wondering if anything has happened.

This is because the Excel application has a very simple and quick task to perform before it closes itself. You may see the Excel icon appear in the taskbar at the bottom of Windows, but it will only be there for seconds.

To verify that the flow has done what you expected, open the folder where you specified the file to be written.

There should be an excel file with the name you specified in this folder. And its contents should contain the text “Hello World” in the first cell.