Depending on the complexity of the automation you sometimes spend hours or even days in creating a new flow and optimizing it. How can you avoid all of this work and knowledge you put into your flow. In general the risk of loosing your flows is not so high any new flow is connected to the Microsoft account that you are using to log into Power Automate Desktop (PAD). Anytime you save a flow it will be automatically synced into the cloud. However, cloud malfunctions and data loss are not unheard of and sometimes a small mismatch in the files metadata can trigger PAD not to show a saved flow anymore. But there is a solution to give you back the sovereignty.
Internally PAD translates the flows you are creating with drag and drop of many predefined building blocks into a script language called Robin. When you save and run a flow from within PAD, it will actually save the Robin script in a specific folder on your PC. As PAD allows you to paste such Robin script into an empty PAD flow and will re-create the building blocks for you, it is a great way to backup (and share) your flows.
We have created a flow that will help you to do such a backup on a regular basis.
- Step: Get the path to the local AppData folder
- Step: Find all files with the extension .robin in the specific PAD folder
- Step: Create a random text as filename for the backup
- Step: Start a loop that processes each robin file, one after the other
- Step: Read the content of the .robin file
- Step: Remove the first 7 lines of each robin file, as they are not needed
- Step: Save the resulting text file with all scripts into the folder C:\PA\Backup
You can easily re-create this flow by opening PAD, selecting “New flow” and copy and pasting the below .robin script into the new, empty flow.
Folder.GetSpecialFolder SpecialFolder: Folder.SpecialFolder.LocalApplicationData SpecialFolderPath=> SpecialFolderPath Folder.GetFiles Folder: $'''%SpecialFolderPath%\\Microsoft\\Power Automate Desktop\\Console\\Workspace''' FileFilter: $'''*.robin''' IncludeSubfolders: True FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files Text.Random UseUpperCaseLetters: True UseLowerCaseLetters: True UseDigits: True UseSymbols: False MinimumLength: 20 MaximumLength: 20 RandomText=> RandomText LOOP FOREACH CurrentItem IN Files File.ReadTextFromFile.ReadTextAsList File: CurrentItem Encoding: File.TextFileEncoding.UTF8 Contents=> FileContents LOOP LoopIndex FROM 0 TO 6 STEP 1 Variables.RemoveItemFromList.RemoveItemFromListByIndex ItemIndex: 0 List: FileContents END File.WriteText File: $'''C:\\PA\\Backup\\%RandomText%.txt''' TextToWrite: $'''%FileContents% ------------------------------------------------''' AppendNewLine: True IfFileExists: File.IfFileExists.Append Encoding: File.FileEncoding.Unicode END
Note: This backup will only backup the flows that have at least run once on this PC using the “Play” button on the main screen of PAD. If you have created your flows on a different machine and have never run them on this machine, they will still show up inside PAD, but they won’t be available as local .robin files for backup.
This flow will only need a couple of seconds to run and the backup file is just a few hundred kilobytes, so it is recommended to run it frequently.
To restore a flow from the backup you need to locate it inside the text files and copy only the specific portion of it and paste it into a new, empty flow.
WHAT IS POWER AUTOMATE DESKTOP?
Power Automate Desktop (PAD) is a tool that allows you to automate all kind of repetitive tasks on your local PC. It is a low-code solution, so there is no need for you to learn a programming language and it is free of charge for Windows 10 and 11 users. PAD is deeply integrated with other Microsoft products like Excel, Outlook, OneDrive, Azure Cloud and has a lot of features for to process data from XML, Jason files, SQL databases and many more with only a little knowledge required about the inner workings of those technologies. Power Automate Desktop is a so-called RPA tool. RPA stands for Robotic Process Automation. There is an online version of Power Automate, too, available under https://powerautomate.microsoft.com/ Instead of automating processes on your local PC it is focused on automating web services and cloud data processing.