Working with Excel
Even in the age of online spreadsheets, Microsoft Excel is still ubiquitous in business processes worldwide. It is used as a data source, graphing tool, and automation tool itself, thanks to its programming capabilities. Working in RPA, you are very likely to meet Excel along the way.
How do you automate Excel?
First of all, there is an important consideration to make. Depending on the nature of the process that you will automate, you might want to work on Excel files directly, for example, reading, writing, and manipulating data inside them. Or you might need to automate the Excel application itself, for example, running macros or using other advanced features.
Our recommendation is always to aim to work with Excel files directly, rather than the Excel application. This approach will give you these advantages:
- No need for Excel software licenses.
- The robot can run on any operating system (not just Windows) and in a container in Control Room.
- The robot will generally run faster.
Which automation libraries should you use?
Use the RPA.Excel.Files
library to manipulate Excel (xls
and xlsx
) files, or the RPA.Excel.Application
library to interact with the Excel application in a Windows environment.
In conjunction with the RPA.Excel.Files
library, you can use the RPA.Tables
library, which provides additional methods to work on tabular data like filtering, ordering, and other operations.
More Python options for manipulating Excel files
If you are familiar with Python, pandas - Python Data Analysis Library, and NumPy, check out Pandas: How to Read and Write Files by Real Python.
Excel files examples
- Check the
RPA.Excel.Files
documentation page for basic examples. - See how to Download and read an Excel file.
- See an example of writing Excel files using a JSON data source.
- This chapter of the Beginners' course details the steps needed to use an Excel file as a data source for your robot.
- See how to handle employee training reminders with Excel files and Python.