Using Excel as a Database in UiPath

A Comprehensive Guide for Doing Setup

Abhimanyu Thite
Globant
5 min readOct 31, 2023

--

Credit: Photo by Rubaitul Azad on Unsplash

UiPath is a powerhouse in the area of Robotic Process Automation (RPA), noted for its ability to automate a wide range of jobs. Working with data is a typical use case for UiPath, and while traditional databases are often used, Excel can also serve as a strong data source. This blog will review best practices and practical examples for using Excel as a database in UiPath.

Why Use Excel as a Database in UiPath?

Excel is a familiar tool for many corporate users, making it an easy data storage and management choice. There are Excel activities present in UiPath for data operations, but for a large amount of data, it takes a lot of time to read/write the files, as compared to operations with a database.

Using Excel as a database in UiPath can provide various benefits:

  • User-Friendly: Excel is extensively used, and the UI is familiar to most users, making it accessible to technical and non-technical team members.
  • Quick Setup: Excel workbooks are a quick solution for data storage since they can be created and filled with data without requiring complicated setups.
  • No Additional Software Required: Unlike conventional databases, Excel does not require the installation or upkeep of additional database software.
  • Portability: Excel files are simple to exchange and move, making them useful for remote teams working on the same project.

Setting Up Excel as a Database in UiPath

In this section, we will see how we can configure the database connection and execute queries.

Configuring the Database

  1. Within the UiPath project to use the database activities it is required to install package UiPath.Database.Activities in project dependencies.
Required Package: UiPath.Database.Activities

2. In UiPath Studio, drag and drop Connect to database activity in your sequence.

Activity: Connect to database

3. Click Configure connection.

Configuration Connection

4. Select Data source and build the connection string.

Building connection string

5. Click on the second tab, Machine Data Source, and select New if there are no data sources created for the Excel files.

Creating New Data Source

6. Select User Data Source and click Next.

Selecting type for Data source

7. Select Microsoft Excel Driver and click on Next.

selecting Excel Driver

8. Click Finish.

Finshing wizard

9. Give a name to Data source.

Excel Data source setup

Give Some Data Source Name and Description → Select workbook → Select the particular Excel file.

11. Once you select the workbook, you will see the below connection string.

Connection string

12. As output, set the variable with type DatabaseConnection, so this variable is used in upcoming activities.

Setting output DatabaseConnection variable

Executing Queries

While working with Database in order to do read/write operations on it, there are activities available in the UiPath such as ‘Run Query’. By using this activity, we can execute the queries. Here are the steps to use this activity.

  1. Use Run Query — Drag and drop the Run query activity from the activities panel.
  2. Provide connection — Set the ‘Existing connection’ property in the properties panel.
    Existing connection = connection
    ‘connection’ is a variable created in the previous section while configuring the database
  3. Getting the Result — Set the ‘Data table’ property in the Output section in the properties panel.
    Data table = dt_sheetData
    dt_sheetData variable is a type of Data table. Activity will Store data from Sheet1 of the Excel sheet to dt_sheetData.
Run Query and its properties to set

Best Practices for Using Excel as a Database

For each solution, there are specific guidelines to follow to do it properly; similarly, while using Excel in this manner, we must consider a few factors that may have an impact on the result. Here are some pointers to consider in order to create a more reliable solution.

  • Structured Data: Ensure your Excel data is well-structured and has relevant headers. This makes working with data in UiPath easier.
  • Consistent File Locations: Maintain file path consistency. Variables or configuration files can be used to manage file paths, making it easy to switch between environments (for example, development, testing, and production).
  • Error Handling: Implement strong error-handling techniques to handle exceptions graciously, such as missing files or inaccurate data.
  • Data Validation: Validate data before returning it to Excel to avoid issues such as duplicates or wrong data types.
  • Performance Considerations: Excel is not as fast as specialized databases for massive datasets. When working with large volumes of data, keep performance in mind.

Conclusion

Using Excel as a database in UiPath is a viable option for various automation applications. It’s simple to use, takes little setup, and is a fantastic solution for small to medium-sized datasets. You may use the power of Excel inside UiPath to optimize your automation processes and boost corporate productivity by adhering to best practices and maintaining an organized approach to data management.

References

Database activities: Activities — Activities (uipath.com)

--

--