Discussion
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2024-05/1f77a272-b558-4261-964a-0a7d028c27c5.jpg?h=436c2321&itok=Ilx-4hBN)
Pegasystems Inc.
US
Last activity: 1 Dec 2023 2:40 EST
Pega Robotics - Excel How To
This series of posts will demonstrate how to use Pega Robotics to automate using the Excel connector. If you follow along and add the automations that we will build in this series into a solution you should end up with a reusable library for automating Excel. In order to automate we will need to understand some fundamentals.
Fundamental #1 - Proxy
When an object has properties that are complex objects, in order to access the Properties, Methods and Events of that property you must extract a proxy. To extract a proxy, right-click on the blue dot and choose Extract Proxy from the context menu.
Fundamental #2 - Casting
Often you may need to iterate through a collection to find the correct object. This is typically done using a ListLoop. The item yielded may be of the correct Type or it may be a generic object. If the ListLoop outputs a generic object, casting the object to the correct Type will render an object that you can extract a proxy from and work with. Pega Robotics can perform this cast operation automatically using a simple trick. Set up an automation that accepts and outputs an object of the required Type and then just pass your object in to it.
Fundamental #3 - Excel Object Model
To work with Excel a basic understanding of the object model is required. It is not complicated, but required to do anything more complicated than reading and writing a cell. What you will use will be principally the following objects:
- Excel Application - this is the top level of the hierarchy and can be used to control the application itself
- Workbooks - the Excel connector can work with a single workbook at a time
- Worksheets - a workbook can contain multiple worksheets, the Excel connector works with the active worksheet
- Range - a range is a collection of cells, it may be a single cell or an entire worksheet or something in between
- Cells - a cell belongs to a range and is the individual cell you see in Excel
To find documentation on Properties, Methods and Events for any of these, search Google using a search string such as "C# Excel Interop worksheet". This should return an article in MSDN which provides you details and some C# code samples.
Starting with the next post we will start to build automations for our Excel library.
***Updated by moderator: Lochan to add FAQ Group Tag***
**Moderation Team has archived post**
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.