Get first free column/row from Excel worksheet Action(Power Automate Desktop)

03/02/2023

Japanese version.

The action is to get +1 of the last number of rows and columns where data exists on the active sheet.

This action is often used to retrieve the cell position where data is to be added in Write to Excel worksheet Action and the last cell position to be read in Read from Excel Worksheet Action.

Since the target to retrieve is the active sheet, if there are multiple sheets, you should also specify the sheets in the Set active Excel worksheet Action.

How to use.

Specify the target file in Launch Excel Action or Attach to Running Excel Action and drag Get first free column/row from Excel worksheet Action from Excel onto the workspace.

Set parameters.

Parameters

Excel instance

Specify the target Excel file.

Specify the Variables produced for the Launch Excel Action or the Attach to running Excel Action.

Variables produced

FirstFreeColumn & FirstFreeRow

FirstFreeColumn is set to the number of columns and FirstFreeRow to the number of rows.

If used for a worksheet like the one below, FirstFreeColumn=6 and FirstFreeRow=7.

When used on a worksheet like the one below, FirstFreeColumn=8 and FirstFreeRow=9

As you can see, even if there are blank rows/columns or rows/columns with half-data, they will still be counted.

On error

Error handling is performed as needed.

Failed to retrieve first free column/row

This is an error when processing fails, such as when data exists up to the last row or column in Excel.

For those who want to learn Power Automate Desktop effectively


The information on this site is now available in an easy-to-read e-book format.

Or Kindle Unlimited (unlimited reading).

You willl discover how to about basic operations.

By the end of this book, you will be equipped with the knowledge you need to use Power Automate Desktop to streamline your workflow.

Links

Excel Actions.

Send newsletter. Email one line at a time from an Excel book.

How to convert Excel files to CSV files.

How to get the last row and last column of an Excel book.

Move to the specified cell in the Excel book.

Delete rows of Excel with specific conditions.