Learn how to use Power Automate Desktop's clipboard actions to capture text from any Windows application, transform it with string manipulation, and paste clean data exactly where it needs to go. This lesson covers timing, retry patterns, and multi-record loops — everything you need to build reliable clipboard-based automations.

Imagine you're a financial analyst who spends two hours every morning copying account numbers from a legacy banking application, reformatting them to remove dashes and leading zeros, and pasting them into a web portal that expects a specific format. You do it hundreds of times, the applications can't talk to each other directly, and there's no API to connect them. This is exactly the kind of problem the Windows clipboard — that invisible buffer that holds whatever you last copied — is perfectly positioned to solve when you combine it with Power Automate Desktop.
The clipboard is one of the most underappreciated automation primitives in Windows. Every application that runs on Windows supports it. It doesn't matter whether you're dealing with a 30-year-old mainframe terminal emulator, a modern web application, or a custom-built desktop tool with no automation hooks — if you can manually copy and paste from it, you can automate that operation. Power Automate Desktop exposes the clipboard through a dedicated group of actions that let your flows capture clipboard content, inspect and transform the text, and paste it somewhere entirely different. When combined with string manipulation, the clipboard becomes a flexible bridge between applications that would otherwise have nothing in common.
By the end of this lesson, you'll know how to build flows that read and write to the Windows clipboard programmatically, clean and reformat text captured from the clipboard, and orchestrate copy-paste operations across multiple Windows applications in a reliable, repeatable way.
What you'll learn:
This lesson assumes you have Power Automate Desktop installed and can create and run basic flows. If you're brand new to the tool, work through Getting Started with Power Automate Desktop: Installing, Recording, and Running Your First Desktop Flow first. You should also be comfortable with the concept of variables — if not, the Variables, Lists, and Data Tables in Power Automate Desktop: A Complete Practitioner's Guide article will give you the foundation you need.
Before writing a single action, it helps to understand what the clipboard actually is. The clipboard is a temporary, operating system-managed storage area. When you press Ctrl+C in any application, that application writes its selected content to the clipboard. When you press Ctrl+V in another application, that application reads from the clipboard and inserts whatever it finds there.
The clipboard holds exactly one thing at a time. If you copy something new, the previous content is gone. This is critically important for automation: your flow must copy, capture, and transform data before anything else touches the clipboard. If another application or Windows itself writes to the clipboard between your copy and your read, you'll capture the wrong content.
Power Automate Desktop interacts with the clipboard in two ways:
You'll use both approaches together. The general pattern looks like this: focus the source application, select the data you want, simulate Ctrl+C to put it on the clipboard, read the clipboard into a PAD variable, transform the text in PAD, write the new value back to the clipboard, focus the destination application, click where you want to paste, and simulate Ctrl+V.
Open Power Automate Desktop, create a new flow, and look in the Actions panel on the left side. Expand the Clipboard category. You'll find three actions:
Get Clipboard Text reads whatever text is currently on the clipboard and stores it in a new variable. The output variable is of type Text.
Set Clipboard Text takes a value you provide — either a literal string or a variable — and writes it to the clipboard. After this action runs, pressing Ctrl+V in any application will paste that value.
Clear Clipboard wipes the clipboard contents entirely. This is useful at the start of a flow to ensure you're not accidentally reading stale data from whatever the user last copied manually.
That's it — three actions. The power comes from combining them with keyboard simulation, UI focus management, and string manipulation.
Note
These clipboard actions only handle plain text. If your source application copies rich text, HTML, images, or formatted tables, PAD will extract the plain text representation. In most data-transfer scenarios this is exactly what you want, but if you need to preserve formatting, you'll need a different approach — such as reading the data directly from the source application's UI elements.
Let's build a concrete example before moving on to more sophisticated scenarios. We'll simulate a common workflow: a customer reference number sits in a plain text file (open in Notepad), and you need to paste it into a web form field after reformatting it.
Our source data looks like this in Notepad:
Customer Ref: CUS-00847-2024
The web form expects the reference number in this format: CUS00847-2024 — no leading zeros on the numeric part, and the prefix dash removed.
Start by making sure Notepad is open with your text file. In your PAD flow, add a Focus Window action to bring Notepad to the front. Set the window title to match your open Notepad file. This ensures your subsequent keyboard actions hit the right application.
Next, add a Send Keys action and set the keystrokes to {Control}({a}). This selects all text in the Notepad window. If your document has just one line of data (as in a real data file scenario), this selects exactly what you need.
Add another Send Keys action with keystrokes {Control}({c}). This tells Notepad to copy the selected text to the clipboard.
Warning
There must be a brief pause between selecting text and copying it, especially in slower applications. Add a Wait action set to 0.5 seconds between the Select All and the Copy keystrokes. Skipping this causes intermittent failures where the copy fires before the selection completes.
Add the Get Clipboard Text action. It will store the clipboard contents in an automatically named variable — rename it to RawClipboardText by clicking the variable name in the action configuration. After this action, RawClipboardText will contain:
Customer Ref: CUS-00847-2024
Now you need to manipulate this string. PAD's Text actions give you what you need. You'll chain a few operations:
First, use Replace Text to strip the label. Set "Text to Parse" to %RawClipboardText%, "Text to Find" to Customer Ref: , "Replacement Text" to nothing (empty string). Store the result in CleanedRef.
After that action, CleanedRef contains CUS-00847-2024.
Next, use Replace Text again on %CleanedRef%, finding CUS-00 and replacing it with CUS. Store the result back in CleanedRef. Now CleanedRef contains CUS847-2024.
Tip
When you have more than two or three text transformations to apply, consider using a Run VBScript or Run PowerShell action and handle the entire transformation in a few lines of regex. The Scripting Inside Desktop Flows: Running PowerShell, Python, and VBScript Actions article covers this pattern in depth. For complex reformatting, a single regex substitution is far more maintainable than ten chained Replace actions.
Add the Set Clipboard Text action. Set the "Clipboard Text" input to %CleanedRef%. The clipboard now holds CUS847-2024 — ready to paste.
Use a Focus Window action to bring your web browser to the front (assuming the web form is already open). Then use the UI Elements and Selectors approach to click the specific input field in the web form. Finally, add a Send Keys action with {Control}({v}) to paste the transformed reference number.
Nothing is more frustrating than a flow that works perfectly when you watch it run but fails silently in production. Clipboard operations are especially prone to timing issues, and understanding why helps you build more robust flows.
When you simulate Ctrl+C, you are asking the currently focused application to do work. The application must receive the keyboard message, process it, serialize the selected content, and write it to the clipboard. This takes time — and that time varies depending on how much data is selected, how busy the application is, and whether Windows is under load.
If your Get Clipboard Text action fires before the application finishes writing to the clipboard, you'll capture either the previous clipboard contents or an empty string.
The fix is layered:
Add explicit waits. After every simulated Ctrl+C, add a Wait action of at least 0.5 to 1 second before reading the clipboard.
Clear the clipboard first, then verify. Before the copy operation, run Clear Clipboard. Then after the copy, check whether the clipboard is empty before proceeding. Use a Get Clipboard Text action followed by an If condition that checks whether the variable equals an empty string — if it does, retry the copy.
Use longer waits for heavy applications. A modern React web app or a legacy SAP screen may take two to three seconds to respond to a copy command. When you're automating SAP or similar complex applications (covered in detail in Automating SAP GUI Interactions with Power Automate Desktop), err on the side of longer waits.
Here's what a retry loop looks like in practice. After your Ctrl+C keystroke:
Set Clipboard Text: '' # Pre-clear before copy isn't always possible,
# but reading after and checking works
Get Clipboard Text → CopiedValue
Loop condition: CopiedValue = '' AND LoopCount < 5
Wait: 1 second
Send Keys: {Control}({c})
Get Clipboard Text → CopiedValue
Increment LoopCount
End Loop
This retry pattern transforms an unreliable clipboard read into a robust operation that self-corrects on timing glitches.
Key insight
The clipboard is a shared resource controlled by Windows. Your flow has no guarantee of exclusive access. On machines where the user might be present (attended automation), warn them — via a display message or a system tray notification — that they should not use the keyboard or clipboard while the flow is running. Unexpected Ctrl+C presses from a human during a bot run are a surprisingly common source of incorrect pastes.
Real workflows rarely process just one item. Let's extend the scenario: you have a Notepad file with fifty account numbers, one per line, and you need to clean and paste each one into a web form sequentially.
The approach:
FileContents.FileContents with a newline character (\n) as the separator. This gives you a List variable called AccountList where each item is one line.AccountList.This pattern processes all fifty records without any manual intervention. The clipboard becomes a relay station, receiving each cleaned value in sequence and delivering it to the target application.
Tip
If the web form clears itself or submits automatically after each paste, make sure you add enough wait time after the paste before the loop moves to the next item. Use Wait for Web Page actions or look for a confirmation element using Web Automation in Power Automate Desktop techniques to synchronize your loop to the page's actual state rather than a fixed timer.
The clipboard approach is powerful but isn't always the right tool. Knowing when to use it — and when not to — will save you debugging time.
Use clipboard operations when:
Prefer direct UI manipulation or file-based transfer when:
The clipboard is best thought of as a last resort that turns out to be a very good one. When you can't get data out of an application any other way, the clipboard will almost always work.
One common pitfall you'll encounter: pasting text that looks correct in PAD's variable inspector but arrives garbled in the destination application. This usually happens because of encoding differences.
Some older applications — particularly those running on terminal emulators or in Citrix-hosted environments — expect a specific character encoding. The Windows clipboard uses Unicode (UTF-16) internally, and most modern applications handle this gracefully. But a 1990s-era application might not.
If you're seeing garbled characters:
[^\x00-\x7F] and replaces with an empty string. This strips any character above ASCII 127.Build a flow that automates the following realistic scenario:
Scenario: You receive a daily text file at C:\Reports\daily_ids.txt. Each line contains an employee ID in this format: EMP_00123_NYC. You need to reformat each ID to EMP-123-NYC (replace underscores with hyphens, remove leading zeros from the numeric segment) and type each reformatted ID into the Windows Search bar, pressing Enter after each one to simulate a lookup operation.
Your tasks:
_ with - and then use a second Replace to strip the leading zeros (replace -00 with - and -0 with -).{LWin}) to open the Start menu search bar.{Control}({v}) to paste.{Return}.Run the flow with a sample file containing five test IDs and verify each one is correctly reformatted and entered.
Warning
Be careful running this exercise on a work machine. Sending the Windows key and Enter in a loop will actually open and interact with the Windows search bar on your desktop. Test with a small sample file (two or three IDs) first, and have your hand near the Stop button in the PAD designer.
Problem: Get Clipboard Text returns an empty string. The application hasn't finished writing to the clipboard when PAD reads it. Add a 1-second Wait between the Ctrl+C keystroke and the Get Clipboard Text action.
Problem: The wrong content is pasted — it's something the user copied earlier. You forgot to clear the clipboard before your copy operation, and the copy itself failed silently. Add a Clear Clipboard action at the very start of your loop, then verify the clipboard has content after copying.
Problem: Text is pasted with extra whitespace or newline characters. Many applications add a trailing newline when you copy a single line. Use a Trim Text action on your captured variable to strip leading and trailing whitespace before transforming the content.
Problem: The paste lands in the wrong field. The focus management is off — the wrong window or field has focus when Ctrl+V fires. Add explicit Focus Window and Click UI Element actions before every paste operation. Don't assume focus persists from a previous action.
Problem: The flow works when watched but fails when run unattended. Unattended runs (explained in Attended vs Unattended RPA: Choosing a Run Mode and Configuring Machines in Power Automate) run in a separate Windows session where the clipboard and UI layer behave differently. Clipboard operations in unattended mode require the session to be interactive (not locked). Ensure your machine is configured correctly for unattended execution.
Problem: Special characters like &, <, or > break when pasted into a web form.
The browser might be interpreting the paste as HTML. Use PAD's Type Text into Web Page action from the web automation group instead of clipboard paste for browser-based forms where possible.
The Windows clipboard is deceptively simple — one place to put things, one place to read them — but when you control it programmatically with Power Automate Desktop, it becomes a universal integration layer that connects any two applications. You've learned how to capture text from a source application using keyboard simulation and the Get Clipboard Text action, transform that text with PAD's string manipulation tools, write the cleaned value back to the clipboard with Set Clipboard Text, and paste it precisely into a destination application.
The key disciplines to carry forward are: always manage focus explicitly before copying or pasting, always add waits after clipboard writes, validate that the clipboard actually contains what you expect before proceeding, and prefer direct UI interaction or file-based transfer when the clipboard isn't necessary.
From here, there are a few natural places to go deeper:
The clipboard isn't glamorous, but reliable clipboard automation has probably saved more person-hours in enterprise environments than any other single RPA technique. Now you know how to build it properly.
Power Automate Desktop & RPA
Automating Internet Explorer and Citrix-Hosted Applications in Power Automate Desktop: Selector Strategies, Session Management, and Reliable Data Extraction from Virtual Environments
Deploying Unattended Desktop Flows at Enterprise Scale: Machine Group Load Balancing, Queue Management, and Run Concurrency Strategies in Power Automate