Learn how to intercept clipboard content, transform it with string manipulation, and paste structured data into target applications using Power Automate Desktop. This hands-on lesson walks through a complete copy-transform-paste workflow with real-world examples and troubleshooting guidance.

Picture this: your team spends part of every workday copying customer reference numbers from a CRM web portal, reformatting them manually to match the naming convention your legacy billing system expects, and pasting them one at a time into a form. The CRM outputs something like CUST-2024-00891, but the billing system wants 891/2024/C. Every copy-paste takes about 20 seconds of focused attention, and when someone rushes it, transposition errors sneak in and cause downstream chaos.
This is exactly the kind of tedious, error-prone glue work that Power Automate Desktop (PAD) was built to eliminate. Rather than automating the entire UI from scratch — clicking every field, waiting for every screen — you can intercept what's already on the clipboard, transform it programmatically, and paste the result wherever the target application expects it. This approach is lighter, faster, and often more resilient than full UI automation because it doesn't depend on a specific application layout staying frozen in time.
By the end of this lesson, you'll know how to read from and write to the Windows clipboard inside a desktop flow, use string manipulation to transform clipboard content into the exact format a target application needs, trigger those operations using keyboard shortcuts, and paste structured data reliably into real applications.
What you'll learn:
You should have Power Automate Desktop installed and be comfortable opening the flow designer and adding basic actions. If you haven't done that yet, work through Getting Started with Power Automate Desktop: Installing, Recording, and Running Your First Desktop Flow first. You should also understand what variables are in PAD — if that's fuzzy, Variables, Lists, and Data Tables in Power Automate Desktop: A Complete Practitioner's Guide will give you a solid foundation before we dive in.
The Windows clipboard is a shared memory area that holds the most recently copied or cut item. When you press Ctrl+C in any application, that application writes its selected content to the clipboard. When you press Ctrl+V, whatever application is currently focused reads from the clipboard and inserts the content.
From an automation perspective, this is a powerful seam. Applications that might resist direct UI automation — because their text fields use unusual controls, or because they're sandboxed inside Citrix, or because they're just old — almost always support standard clipboard operations. If a human can Ctrl+C and Ctrl+V, your flow can too.
Key insight
The clipboard is application-agnostic. Whether you're moving data between a browser, a legacy Win32 app, SAP, or Notepad, the clipboard is a universal handoff point. This makes clipboard-based automation one of the most portable techniques in your RPA toolkit.
The clipboard has limitations, though. It holds only one item at a time, the contents are overwritten every time something new is copied, and it deals primarily with plain text in automation scenarios (rich formatting, images, and other MIME types are possible but considerably more complex). For the patterns we're covering here — moving and transforming structured text between applications — plain text clipboard operations are exactly what we need.
Power Automate Desktop provides three clipboard-focused actions you'll use constantly. Let's walk through each one before we combine them into a workflow.
This action reads whatever text is currently on the clipboard and stores it in a variable. Find it by opening the action panel on the left side of the flow designer and searching for "clipboard," or by navigating to the Clipboard category.
When you drag this action into your flow, it asks you to name the output variable. Name it something meaningful, like ClipboardText or RawCRMReference, not just Var1. The action produces a text variable containing exactly what's on the clipboard at the moment the action executes.
This action writes a value to the clipboard, replacing whatever was there. You provide a text value — either a hardcoded string or a variable — and after this action runs, that value is now what any subsequent Ctrl+V in any application will paste.
Warning
Setting the clipboard overwrites its current contents permanently (until something else writes to it). If your flow is running attended alongside a user, they may notice their clipboard contents changing unexpectedly. For workflows where the user is actively working in parallel, consider building in a clipboard restore step — capture the initial clipboard state, do your transformation and paste, then restore the original value.
This action simulates keyboard input to the currently focused application. It's how you send Ctrl+C to trigger a copy or Ctrl+V to trigger a paste. You'll find it in the UI Automation category or by searching "send keys."
The key syntax PAD uses looks like this:
{Control}({c}) for Ctrl+C{Control}({v}) for Ctrl+V{Tab} for the Tab key{Return} for EnterYou can combine these to build complex keyboard sequences. For example, to select all text in a field, copy it, and then tab to the next field:
{Control}({a}){Control}({c}){Tab}
Tip
The Send Keys action requires a window to be focused first. Always precede it with a Focus Window action or a Click on the target element to make sure keystrokes go to the right place. Sending keys to the wrong window is one of the most common sources of hard-to-debug automation failures.
Grabbing text from the clipboard is only half the job. The real power comes from transforming that text before you paste it. PAD has a rich library of text manipulation actions, and for more complex transformations, you can drop into a quick PowerShell or VBScript block.
Let's work through the CRM-to-billing scenario from the introduction. The source format is CUST-2024-00891 and the target format is 891/2024/C.
Here's how we'd think through the transformation:
- delimiter to get three parts: CUST, 2024, 0089100891) and strip the leading zeros to get 8912024) as-is891/2024/CUse the Split Text action from the Text category. Set the text to your ClipboardText variable and the delimiter to -. This produces a list variable — let's call it ReferenceParts. The list will have three items:
ReferenceParts[0] = CUSTReferenceParts[1] = 2024ReferenceParts[2] = 00891The number 00891 needs to become 891. The cleanest way to do this in PAD is to convert the text to a number and back to text, which automatically drops leading zeros. Use the Convert Text to Number action on ReferenceParts[2], storing the result in NumericID. Then use Convert Number to Text to get CleanID. PAD will give you 891 without the padding.
Alternatively, if you're comfortable with it, the Scripting Inside Desktop Flows: Running PowerShell, Python, and VBScript Actions approach lets you do this entire transformation in a single line:
$input = "CUST-2024-00891"
$parts = $input -split "-"
$id = [int]$parts[2]
$year = $parts[1]
$output = "$id/$year/C"
Write-Output $output
Use the Format Text action or simple variable concatenation to build the final string. In PAD's expression syntax:
%CleanID% + '/' + %ReferenceParts[1]% + '/C'
Store the result in a variable called FormattedReference. Now you're ready to paste it.
Note
PAD's text manipulation actions handle most common transformations — trimming whitespace, replacing substrings, changing case, extracting substrings by position. Before reaching for PowerShell, check whether a built-in Text action covers your case. The built-in actions are easier to read and maintain for someone inheriting your flow later.
Now that FormattedReference holds exactly what the billing system needs, we write it to the clipboard and trigger the paste.
Use Set Clipboard Text with %FormattedReference% as the value. After this action executes, the clipboard contains 891/2024/C.
Before sending Ctrl+V, you need to make sure the billing system window is active and the cursor is in the right field. The sequence looks like this in your flow:
Billing System*.{Control}({v}) to trigger the paste.For step 2, if the billing application is a standard Windows desktop app, you can use the UI Automation actions to click a named text field directly. If it's a more unusual environment, the approaches covered in Automating Legacy Windows Applications with UI Automation in Power Automate Desktop will help you handle tricky control identification.
Tip
After pasting, consider using Get UI Element Detail to verify the field's value matches what you expected before submitting the form. A quick sanity check here can save you from submitting bad data silently.
Let's put everything together as a complete, numbered flow. This represents the full automation for our CRM-to-billing scenario.
Flow structure:
1. Focus Window: "CRM Portal - Customer Detail"
2. Click: Customer Reference Number field
3. Send Keys: {Control}({a}) ← Select all text in the field
4. Send Keys: {Control}({c}) ← Copy selected text to clipboard
5. Wait: 0.5 seconds ← Brief pause for clipboard to settle
6. Get Clipboard Text → ClipboardText
7. Split Text: ClipboardText on '-' → ReferenceParts
8. Convert Text to Number: ReferenceParts[2] → NumericID
9. Convert Number to Text: NumericID → CleanID
10. Set Variable: FormattedReference = CleanID + '/' + ReferenceParts[1] + '/C'
11. Set Clipboard Text: FormattedReference
12. Focus Window: "Billing System - New Entry"
13. Click: Reference Number input field
14. Send Keys: {Control}({v}) ← Paste transformed value
15. Send Keys: {Tab} ← Move to next field
That Wait action on line 5 deserves an explanation. After sending Ctrl+C, there's a tiny window of time before the clipboard is actually updated — the application needs to process the keypress and write to the clipboard. On most machines this is imperceptible, but under CPU load or in remote desktop sessions, skipping this wait can cause your flow to read stale clipboard contents. Half a second is usually plenty.
The Wait action is in the Flow Control category. Set it to 0.5 seconds (enter 0.5 in the duration field).
This kind of multi-application data transfer workflow gets more interesting when you're looping through many records. For a deeper look at orchestrating data across multiple apps in a single flow, see Automating Multi-Application Workflows in Power Automate Desktop: Transferring Data Between Windows Apps, Web Browsers, and Excel in a Single Desktop Flow.
Real-world clipboard content is messy. Before your transformation logic runs, you should defensively clean and validate the clipboard text.
Users sometimes accidentally copy trailing spaces or newline characters along with the text they intend to copy. The Trim Text action removes leading and trailing whitespace. Add it right after Get Clipboard Text, before you do anything else with the value.
Before splitting on -, confirm that the text actually matches the pattern you expect. The If Text Contains conditional action lets you check whether ClipboardText contains a hyphen before proceeding. If it doesn't, route to an error message and stop.
If ClipboardText does not contain '-':
Display Message: "Clipboard content doesn't look like a CRM reference.
Please copy a valid reference number and try again."
Stop Flow
If the clipboard is empty when your flow reads it, Get Clipboard Text will return an empty string. An empty string passed to Split Text will produce a single-element list that breaks your indexing on subsequent steps. Check for this:
If ClipboardText = '':
Display Message: "Nothing was found on the clipboard."
Stop Flow
Good defensive validation here connects directly to the error handling mindset covered in Error Handling in Desktop Flows: On Block Error, Retry Policies, and Recovery Screenshots. Wrapping your clipboard read and transformation steps in an On Block Error handler means that even unexpected failures — say, the clipboard contains rich text that can't be processed as plain text — won't crash your entire flow silently.
The Send Keys action isn't limited to clipboard shortcuts. You can use it to trigger any keyboard shortcut in the focused application. This makes it useful for:
{Alt}({f}) for File menu, {Alt}({e}) for Edit{Tab}, {Shift}({Tab}), arrow keys{Return} or {Alt}({s}) for SaveFor the billing scenario, after pasting the reference number, you might want to send additional shortcuts to populate other fields from other clipboard operations, navigate to a submission button, and confirm the entry — all without touching the mouse.
A realistic extended sequence might look like this:
Send Keys: {Control}({v}) ← Paste reference number
Send Keys: {Tab} ← Move to Account Name field
Send Keys: {Control}({v}) ← Paste pre-loaded account name
(you'd need to set clipboard again first)
Send Keys: {Tab} ← Move to Amount field
Type: 1500.00 ← Type amount directly (no clipboard needed)
Send Keys: {Return} ← Submit
Notice the mix of clipboard-based paste and direct typing via the Type action (also in the UI Automation category). Use clipboard operations when the data needs transformation. Use direct typing when the value is already computed and doesn't need to pass through the clipboard.
Warning
Some applications block programmatic paste for security reasons — financial trading platforms and certain healthcare systems are common examples. If Ctrl+V doesn't work, try using the Populate Text Field UI Automation action instead, which writes directly to the control's value property rather than simulating keyboard input. The Automating Data Entry into Windows Desktop Applications with Power Automate Desktop lesson covers this alternative approach in depth.
Scenario: You have a list of employee IDs in a Notepad file, formatted as EMP_00042_HR. You need to transform each one into HR-42 and paste each transformed value into a simple text file (a second Notepad instance) one per line.
Steps to build this flow:
Open two Notepad windows. In the first, type three employee IDs on separate lines: EMP_00042_HR, EMP_00107_FIN, EMP_00008_OPS. Save the file.
In PAD, create a new flow. Add Launch Application to open the first Notepad file.
Add Get Window and Focus Window to bring Notepad into focus.
Use Send Keys with {Control}({Home}) to jump to the top of the document, then {Home} to position at the start of the first line.
Add a Loop that repeats 3 times (or use a more robust file-reading approach — see Reading and Writing to CSV and Text Files in Power Automate Desktop for how to read lines from a file properly).
Inside the loop:
{Home}{Shift}({End}) to select the current line{Control}({c}) to copy itRawIDRawID → TrimmedIDTrimmedID on _ → IDPartsIDParts[1] to number → NumericPartCleanNumFormattedID = IDParts[2] + - + CleanNumFormattedID{Control}({End}) to move to end of document{Control}({v}) to paste{Return} to add a new line{Down} to move to the next lineRun the flow and verify the second Notepad contains:
HR-42
FIN-107
OPS-8
The clipboard reads stale data. If your flow copies something but then reads the previous clipboard value, the culprit is almost always the missing wait step. Add a 0.5-second wait between the Send Keys Ctrl+C action and the Get Clipboard Text action.
Send Keys goes to the wrong window. This happens when focus shifts between actions — perhaps a notification popup appeared, or a background app grabbed focus. Always use a Focus Window action immediately before Send Keys, not just at the beginning of the flow.
The paste produces garbled characters. Some applications handle Ctrl+V differently depending on locale settings or input method settings. Try using the Populate Text Field UI Automation action as an alternative. Also check that your transformed text variable doesn't contain unexpected Unicode or escape sequences.
Split Text gives the wrong number of parts. If your source data has an inconsistent delimiter count — CUST-2024-00891 sometimes arrives as CUST--00891 with a double hyphen, for instance — your index references will be off. Add validation before splitting: check that the text contains exactly two hyphens using Count Occurrences of Text in Text and handle mismatches gracefully.
The clipboard is empty when the flow reads it. The user may not have anything selected, or the application may not support copy via keyboard. Consider using Get UI Element Detail to read the field value directly instead of going through the clipboard, as a more reliable fallback.
You've now seen the full anatomy of clipboard-based automation in Power Automate Desktop: reading what's on the clipboard, transforming it with text manipulation actions, writing the result back, and triggering paste with keyboard shortcuts. This pattern is deceptively simple but handles a huge share of real-world integration work — especially in environments where you can't install APIs, can't get database access, and can't modify the applications involved.
The key ideas to take away:
For a broader look at clipboard operations — including moving data between applications without any UI interaction at all — explore Automating Windows Clipboard Operations in Power Automate Desktop: Copying, Pasting, and Transferring Data Between Applications Without UI Interaction. And if you find yourself building flows that run on a schedule without anyone watching, check out Attended vs Unattended RPA: Choosing a Run Mode and Configuring Machines in Power Automate to understand how clipboard-based workflows behave differently when no user session is active.
Power Automate Desktop & RPA