UiPath

Manipulate Excel with Modern Activities using UiPath

This article describes how to work with Excel in Modern Activities.

Proceed to Table of Contents

The operator of this blog, F-penIT blog

This site was created by translating a blog created in Japanese into English using the DeepL translation.

Please forgive me if some of the English text is a little strange

Modern and Classic Activities

UiPath 2023.6 is configured by default to operate on modern activities in Excel.

If you want to use classic activities, check the “Classic” checkbox under “Filter Criteria” for the activity.

Excelのモダンとクラシックアクティビティの違い

クラシック(英語)モダン(英語)
Excel Application ScopeUse Excel File
Excel Process ScopeExcel Process Scope
Single Excel Process Scope
Append To CSVAppend To CSV
Read CSVRead CSV
Write CSVWrite CSV
Delete ColumnDelete Column
Filter TableFilter
Get Table Range
Insert ColumnInsert Column
Sort Table
Append RangeAppend Range
Close Workbook
Get Cell Color
Read CellRead Cell Value
Read Cell FormulaRead Cell Formula
Read Column
Read RangeRead Range
Read Row
Select Range
Set Range Color
Write CellWrite Cell
Write RangeFill Range
Save WorkbookSave Excel File
Save Excel File As
Create TableCreate Table
Get Workbook Sheet
Get Workbook Sheets
Refresh Pivot TableRefresh Pivot Table
Create Pivot TableCreate Pivot Table
Filter Pivot Table
Change Pivot Data Source
Get Selected Range
Copy Sheet
Delete Range
Auto Fill RangeAuto Fill
Copy Paste RangeCopy Paste Range
Execute MacroRun Spreadsheet Macro
Insert/Delete ColumnsDelete Column
Insert/Delete RowsDelete Rows
Insert Rows
Invoke VBA
LookUp Range
Remove Duplicates RangeRemove Duplicates
Autofit Range
Clear Sheet/Range/Table
Copy/Paste Range
Export to CSV
Delete Sheet
Duplicate Sheet
Find First/Last Data Row
Find/Replace Value
For Each Excel Row
For Each Excel Sheet
Format As Table
Format Cells
Get Excel Chart
Insert Chart
Update Excel Chart
Insert Sheet
Match Function
Protect Sheet
Refresh Excel Data Connections
Save Excel File
Rename Sheet
Save Excel File As PDF
Sort Range
Text to Columns
Unprotect Sheet
Update Excel Chart
VLOOKUP
Clear Sheet/Range/Table
Write DataTable to Excel
F-pen

The modern version has more features. In addition, more features will be added to the modern version in the future.

Manipulation of Excel files

To work with Excel files in a Modern Activity, use “Use Excel File” within the “Excel Process Scope” or “Single Excel Process Scope” to specify the Excel file.

Excel Process Scope

Excel Process Scope setting items

Setup LocationSetting itemsConfiguration details
CommonDisplayNameThe display name of the activity.
MiscPrivateIf selected, the values of variables and arguments are no longer logged at Verbose level.
OptionsDisplay alertsIf selected, Excel can display alerts and messages.
Existing processes actionThe action to be executed if other Excel processes are running.
File conflict resolutionThe action to be executed if Excel file conflicts are detected between Excel processes.
Launch methodDetermines whether an Excel process is launched via COM APIs or as full process.
Launch timeoutThe time to wait for Excel to start in seconds, if launched as a full process.
Macro settingsSpecifies the macro level for the current Excel file.
Process modeDetermines how the Excel Process Scope activity manages Excel processes:
Show Excel windowIf selected, Excel windows appear during the automation.

Single Excel Process Scope

Single Excel Process Scope setting items

Setup LocationSetting itemsConfiguration details
CommonDisplayNameThe display name of the activity.
MiscPrivateIf selected, the values of variables and arguments are no longer logged at Verbose level.

Use Excel File

[jin_icon_informationUse Excel File setting items

Setup LocationSetting itemsConfiguration details
CommonDisplayNameThe name displayed for the activity in the Designer panel.
FileEdit passwordThe password required for editing the Excel workbook, if the file is password-protected.
PasswordThe password required for opening the Excel workbook, if the file is password-protected.
Workbook pathThe path to the Excel file. If the file does not exist and you select the CreateNewFile option, StudioX creates the file.
MiscPrivateIf selected, the values of variables and arguments are no longer logged at Verbose level.
OptionsCreate if not existsSee the description in the body of the activity.
Keep excel file openIf the file is not open at the time the project runs, keeps the workbook open after the project finished running instead of closing it.
Read FormattingSee the description in the body of the activity.
Read-onlyIf selected, the specified workbook is opened in Read-Only mode.
Save changesSee the description in the body of the activity.

Example of the use of an activity added in modern

Filter Pivot Table

Filter Pivot Table setting items

Setup LocationSetting itemsConfiguration details
In the Body of the ActivitySourceClick Plus on the right side of the field, select the file, and then select a pivot table to filter, or select Indicate in Excel to open the file and select a pivot table directly from the file.
Column nameThe column to filter on. You can select a filter, column label, or row label.
Configure FilterClick this button to configure the filter for the values in the column.
Clear any existing filterSelect this option if you want to clear existing filters instead of creating a new one.
CommonDisplayNameThe name displayed for the activity in the Designer panel.
InputColumn nameThe column to filter on. You can select a filter, column label, or row label.
Configure FilterClick this button to configure the filter for the values in the column.
MiscPrivateIf selected, the values of variables and arguments are no longer logged at Verbose level.
OptionsClear any existing filterSee Clear any existing filter in the body of the activity.

sample process

Change the filters in the pipot table.

– workflow

– Excel of data

– Excel sheet for configuration changes

– Pipot sheet after execution

sea otter

The subject you specified in the workflow has been selected.

Autofit Range

Autofit Range setting items

Setup LocationSetting itemsConfiguration details
In the Body of the ActivitySelect a sourceClick Plus on the right side of the field, select the file, and then select a named range, table, or sheet as the source, or select Indicate in Excel to open the file and select a range directly from the file.
ColumnsIf selected, autofit is applied to the columns in the range.
Rows If selected, autofit is applied to the rows in the range.
CommonDisplayNameThe name displayed for the activity in the Designer panel.
InputRangeSee Select a source in the body of the activity.
MiscPrivateIf selected, the values of variables and arguments are no longer logged at Verbose level.
OptionsColumns If selected, autofit is applied to the rows in the range.
Rows If selected, autofit is applied to the rows in the range.

sample process

Change the auto-adjustment of Excel cell ranges.

– workflow

– Target Excel

– Excel after execution

F-pen

After execution, Excel automatically adjusts the vertical and horizontal ranges.

Clear Sheet/Range/Table

Clear Sheet/Range/Table setting item

Setup LocationSetting itemsConfiguration details
In the Body of the ActivityRange to clearClick Plus on the right side of the field, then, from the menu, select the file and then a sheet, table, or range to clear, or select Indicate in Excel to indicate a range directly from the file.
Has headersIf selected, it indicates that the first row in the defined range is a header row and should not be cleared of data.
CommonDisplayNameThe name displayed for the activity in the Designer panel.
InputRange to clearSee Range to clear in the body of the activity.
MiscPrivateIf selected, the values of variables and arguments are no longer logged at Verbose level.
OptionsHas headersSee Has headers in the body of the activity.

sample process

Clear a specific sheet in Excel.

– workflow

– Target Excel

– Excel after execution

sea otter

The value of each cell has been cleared.

Delete Sheet

Delete Sheet setting item

Setup LocationSetting itemsConfiguration details
In the Body of the ActivitySelect sheetClick Plus on the right side of the field and then, from the menu, select the file and then the sheet to delete. If you select Indicate in Excel, you can select any cell or range from the sheet you want to delete directly from the file.
CommonDisplayNameThe name displayed for the activity in the Designer panel.
InputSelect sheetSee Select sheet in the body of the activity.
MiscPrivateIf selected, the values of variables and arguments are no longer logged at Verbose level.

sample process

Delete an Excel sheet.

– workflow

– Target Excel

– Excel after execution

F-pen

“Sheet1” has been deleted from the target Excel.

For Each Excel Row

For Each Excel Row setting item

Setup LocationSetting itemsConfiguration details
In the Body of the ActivityFor eachEnter the name by which to refer to the current row in the iteration.
In rangeClick Plus on the right side of the field and then, from the menu, select the range, table, or sheet to use, or select Indicate in Excel to open the file and select a range directly from the file.
Has headersIf selected, it indicates that the first row in the range is a header row.
Save after each rowIf selected, the Excel file is saved during project execution after each row in the iteration is processed.
CommonDisplayNameThe name displayed for the activity in the Designer panel.
MiscPrivateIf selected, the values of variables and arguments are no longer logged at Verbose level.
OptionsEmpty Row BehaviorSelect how the automation should behave if an empty row is encountered:
Has HeadersIf selected, it indicates that the first row in the range is a header row.
In rangeClick Plus on the right side of the field and then, from the menu, select the range, table, or sheet to use, or select Indicate in Excel to open the file and select a range directly from the file.
Save each rowSee Save each row in the body of the activity.

sample process

Output data to log using Excel iterations (each row in Excel).

– workflow

– Excel to be read

– Post-execution log

ラッコくん

The values of cells A1~A4 are output to the log.

For Each Excel Sheet

For Each Excel Sheet setting item

Setup LocationSetting itemsConfiguration details
In the Body of the ActivityFor eachEnter the name by which to refer to the current sheet in the iteration.
In workbookClick Plus on the right side of the field and then, from the menu, select the Excel file whose sheets to iterate through Alternatively, you can select Open in Advanced Editor to enter a VB expression.
CommonDisplayNameThe name displayed for the activity in the Designer panel.
MiscPrivateIf selected, the values of variables and arguments are no longer logged at Verbose level.
WorkbookSee In workbook in the body of the activity.

sample process

Output cell A1 of each Excel sheet to the log.

– workflow


・”Sheet1″ in the target Excel

– “Sheet2” in the target Excel

– Execution Result Log

F-pen

A1 of “Sheet1” and A1 of “Sheet2” are logged out from the target Excel.

Format Cells

Format Cells setting item

Setup Location所Setting itemsConfiguration details
In the Body of the ActivitySourceClick Plus on the right side of the field, then, from the menu, select the file and then a sheet, table, or range to format, or select Indicate in Excel to indicate a range directly from the file.
Format data as typeClick Set Format to open the Format cells window and then select what to format in the cells using the options at the top: Data Type (number format), Alignment (horizontal, vertical, wrap text), Font (font, font style, underline style, font size, color), or Fill (color). Depending on your selection, other options may appear for additional configuration.
CommonDisplayNameThe name displayed for the activity in the Designer panel.
InputSee SourceClick Plus on the right side of the field, then, from the menu, select the file and then a sheet, table, or range to format, or select Indicate in Excel to indicate a range directly from the file.
MiscPrivateIf selected, the values of variables and arguments are no longer logged at Verbose level.

sample process

Change the formatting of Excel cells.

– workflow

– Formatting of “Format Cells”

– Target Excel

– Excel after execution

ラッコくん

The formatting settings are reflected in cell A1.

Insert Chart

Insert Chart setting item

Setup LocationSetting itemsConfiguration details
In the Body of the ActivityChart categoryClick the drop-down menu to select the category of the chart to be created.
Chart typeClick the drop-down menu to select the chart type to be created based on the category that was selected.
Data RangeClick Plus on the right side of the field, then, from the menu, select the file and then a sheet, table, or range where to insert the chart, or select Indicate in Excel to indicate a range directly from the file.
Inert into sheetClick Plus on the right side of the field, then, from the menu, select the file and then a sheet, or select Indicate in Excel to indicate a sheet directly from the file. Alternatively, you can select Custom Input to enter a sheet name manually, or Open in Advanced Editor to enter a VB expression.
Save chart toSaves the chart for use in other activities.
CommonDisplayNameThe name displayed for the activity in the Designer panel
InputChart categorySee Chart category in the body of the activity.
Chart heightSpecify the height of the chart.
Chart leftCoordinates of how far to the right of the sheet the new chart will be inserted.
Chart topCoordinates of how far from the top of the sheet the chart will be inserted.
Chart typeSee Chart type in the body of the activity.
Chart widthSpecify the width of the chart.
Data rangeSee Data range in the body of the activity.
Insert into sheetSee Insert into sheet in the body of the activity.
MiscPrivateIf selected, the values of variables and arguments are no longer logged at Verbose level.
OutputSave chart toSee the options in the body of the activity.

sample process

Insert graphs into Excel.

– workflow

– Properties of Insert Graph

– Data to be graphed in Excel

– Pre-execution GRAPH SHEET

– Post-execution GRAPH SHEET

エフペン

The contents of the DATA sheet are graphed.

Save Excel File As PDF

Save Excel File As PDF setting item

Setup LocationSetting itemsConfiguration details
In the Body of the ActivityWorkbookClick Plus on the right side of the field and then, from the menu, select the Excel workbook to save as PDF.
Save as fileClick Browse next to the field, and then browse to the folder where to create the file and enter the file name.
CommonDisplayNameThe name displayed for the activity in the Designer panel.
FileDestination pdf pathSee Save as file in the body of the activity.
InputEnd pageOptionally, specify the number of the last page to include in the PDF.
Save qualitySelect the quality at which to save the file, either Standard Quality (optimized for online publishing and printing) or Minimum Quality (optimized for online publishing).
Start pageOptionally, enter the number of the first page to include in the PDF.
WorkbookSee Workbook in the body of the activity.
MiscPrivateIf selected, the values of variables and arguments are no longer logged at Verbose level.

sample process

Save Excel file as PDF.

– workflow

– Excel to PDF

– PDF-edited file after execution

VLOOKUP

VLOOKUPの設定項目

設定場所設定項目設定内容
In the Body of the ActivityValue to lookupClick Plus on the right side of the field, and then, from the menu, select what to look for using one of the available options:
In rangeClick Plus on the right side of the field, and then, from the menu, select the range where to search for the value.
Column indexClick Plus on the right side of the field and then, from the menu, select Number and enter the column number containing the value to return.
Exact matchIf selected, it indicates you want to return only exact matches.
Save toClick Plus on the right side of the field and then, from the menu, select where to save the result:
CommonDisplayNameThe name displayed for the activity in the Designer panel.
InputValue to lookupClick Plus on the right side of the field, and then, from the menu, select what to look for using one of the available options:
In rangeClick Plus on the right side of the field, and then, from the menu, select the range where to search for the value.
Exact matchIf selected, it indicates you want to return only exact matches.
Save toThe name displayed for the activity in the Designer panel.
MiscPrivateIf selected, the values of variables and arguments are no longer logged at Verbose level.
OutputOutput toSee Save to in the body of the activity.

sample process

Enter the matching value in the cell with VLOOKUP.

– workflow

・VLOOKUP化するデータ

– Vlookup sheet after execution

ラッコくん

Tanaka’s scores are output on B1 of the Vlookup sheet.

Write DataTable to Excel

Write DataTable to Excel setting item

Setup LocationSetting itemsConfiguration details
In the Body of the ActivityWhat to writeClick Plus on the right side of the field, and then use one of the options in the menu to indicate the data to write:
DestinationClick Plus on the right side of the field and then, from the menu, select the Excel file and then a named range, table, or sheet where to write the data, Indicate in Excel to open the file and select a range directly from the file, or Custom Input to enter the destination range manually.
AppendIf selected, the data is added starting with the first blank row in the destination range.
Exclude headersIf selected, the header row or the first row in the source range is not written in the destination range. This option is not selected by default.
CommonDisplayNameThe name displayed for the activity in the Designer panel.
InputWhat to writeClick Plus on the right side of the field, and then use one of the options in the menu to indicate the data to write:
MiscPrivateIf selected, the values of variables and arguments are no longer logged at Verbose level.
OptionsIgnore epmty source
AppendIf selected, the data is added starting with the first blank row in the destination range.
Exclude headersIf selected, the header row or the first row in the source range is not written in the destination range.
OutputDestinationClick Plus on the right side of the field and then, from the menu, select the Excel file and then a named range, table, or sheet where to write the data, Indicate in Excel to open the file and select a range directly from the file, or Custom Input to enter the destination range manually.

sample process

Write data tables to Excel.

– workflow

– Data from “Build Data Table”

– Excel file after execution

F-pen

The contents of the data table are output to Excel.

Summary

  1. UiPath 2023.6 is set to work with Excel’s Modern Activities by default.
  2. If you want to use Classic Activity, check [Classic] in [Filter Criteria] of Activity.
  3. It is the policy to add new features to the Modern Activity.

Back to Table of Contents

ABOUT ME
F-Pen
Japanese IT engineer with a wide range of experience in system development, cloud building, and service planning. In this blog, I will share my know-how on UiPath and certification. profile detail / twitter:@fpen17