Hello Developers! In this blog, I’ll walk you through one of the most fundamental concepts in Power Automate Desktop (PAD): variables. If you are just starting with PAD or automation in general, this will be a great starting point to understand how data is stored, passed, and manipulated inside your desktop flows.

What are Variables in Power Automate Desktop?

Let me put it in simple terms: variables are like containers where you can store data temporarily while your automation is running. You can store numbers, text, dates, lists, and even complex data types, such as custom objects.

Think of them like tiffin boxes, you can store different types of food (data) in each box (variable), carry them with you (use in other steps), and even change the contents later.

Why Do We Need Variables?

Let’s say you are automating a task to read an Excel file, filter some data, and send a summary email. In this case, you will need to.

Without variables, this would be like cooking without utensils – messy and impossible to manage!

How to Create Variables in Power Automate Desktop?

PAD makes it very easy to create and use variables. There are two common ways to create variables:

Method 1. Automatically by Actions

This is the most common way. Many actions in PAD automatically generate output variables.

Example

When you use the 'Read from Excel worksheet' action, it will provide an output, such as ExcelData, which you can use in the following steps.

You can rename it if you want to something like dtEmployeeData for better readability.

Pro Tip: Always give meaningful names to your variables. It’ll help when your flows grow bigger.

Method 2. Manually Using “Set Variable” Action

If you want to create and assign a value to a variable manually, follow these steps:

Steps

Types of Variables in PAD

PAD supports many types of variables depending on your use case. Some of the commonly used ones.

Variable Type Example
Text "Hello, World"
Number 100, 3.14>
Boolean True, False
DateTime 05/06/2025 12:30 PM
List ["Gowtham", "Raj", "Anand"]
DataTable A full table from Excel
File/Folder Paths to files or folders

As you become more advanced, you’ll use loops and conditions to manipulate these variable values.

Example Use Case

Let’s build a small scenario.

Goal: Show a greeting message to the user based on the current time.

Steps

Step 1. Get Current Time.

You can rename it to something like currentTime

Step 2. Convert datetime to text.

Step 3. Extract the Hour using Substring.

Example: From 06/04/2025 09:45:00, this gives "09".

Substring

Step 4. Convert to Number.

Convert to Number

Step 5. Use If Condition

Condition: %TextAsNumber% < 12

Condition

Step 6. Display Greeting

Bonus Tips

Final Thoughts

In the world of automation, variables are your best friends. They help your brain remember, make decisions, repeat actions, and respond. Once you master variables, you’re already halfway through mastering Power Automate Desktop!

So next time when you build a flow, give a slight nod to your hardworking variables.

Do you have any doubts or real-world automation problems? Drop a comment or message me on C# Corner. Let’s learn and grow together.

Happy Automating!