Skip to content

Clear data stored on the clipboard

Power Automate Desktop can send keyboard input as hardware input, so it can reproduce user operations such as copy and paste. By using actions, you can also work with the clipboard directly.

Also, flows sometimes handle sensitive information, so it’s best to leave as little data behind as possible and restore the state from before the run.

This article explains how to clear the clipboard value.

Details of the “Clear clipboard contents” action

Section titled “Details of the “Clear clipboard contents” action”

The action used here is called “Clear clipboard contents.”

This action has no parameters and doesn’t produce any variables. When it runs, it deletes the clipboard contents at that moment.

action

Add the sample flow by copying and pasting

Section titled “Add the sample flow by copying and pasting”

As a sample, I prepared a flow that overwrites the clipboard value, clears it, and then stores the resulting clipboard value in a variable.

Copy the following code and paste it into the Power Automate Desktop flow designer to add the actions.

Clipboard.SetText Text: $'''changed from power automate desktop'''
Clipboard.Clear _
Clipboard.GetText Text=> ClipboardText

An empty string is stored in the variable.

  1. In “Search actions,” type “Clear clipboard contents” and add the action.
  2. When you run the flow, the clipboard contents at that moment are deleted.

This action never throws an exception (error), so you don’t need to add error handling with an “On block error” block.