- Overview
- Excel
- Release Notes
- About the Excel activity package
- Project Compatibility
- Supported character encoding
- Project Settings
- Add or Update Excel Sensitivity Label
- Append Range
- Auto Fill
- Autofit Range
- Change Pivot Data Source
- Clear Sheet/Range/Table
- Copy/Paste Range
- Create Pivot Table
- Delete Column
- Delete Rows
- Delete Sheet
- Duplicate Sheet
- Export to CSV
- Fill Range
- Filter
- Filter Pivot Table
- Find First/Last Data Row
- Find/Replace Value
- For Each Excel Row
- For Each Excel Sheet
- Format As Table
- Format Cells
- Get Cell Color
- Get Excel Chart
- Get Excel Sensitivity Label
- Get Selected Range
- Insert Column
- Insert Chart
- Insert Rows
- Insert Sheet
- Invoke VBA
- Lookup
- Match Function
- Protect Sheet
- Read Cell Formula
- Read Cell Value
- Read Range
- Refresh Excel Data Connections
- Refresh Pivot Table
- Remove Duplicates
- Rename Sheet
- Run Spreadsheet Macro
- Save Excel File
- Save Excel File As
- Save Excel File As PDF
- Select Range
- Sort Range
- Text to Columns
- Unprotect Sheet
- Update Excel Chart
- Use Excel File
- VLookup
- Write Cell
- Write CSV
- Write DataTable to Excel
- Excel Application Scope
- Append To CSV
- Read CSV
- Write CSV
- Delete Column
- Filter Table
- Get Table Range
- Insert Column
- Sort Table
- Append Range
- Close Workbook
- Get Cell Color
- Read Cell
- Read Cell Formula
- Read Column
- Read Range
- Read Row
- Select Range
- Set Range Color
- Write Cell
- Write Range
- Save Workbook
- Create Table
- Get Workbook Sheet
- Get Workbook Sheets
- Refresh Pivot Table
- Create Pivot Table
- Get Selected Range
- Copy Sheet
- Delete Range
- Auto Fill Range
- Copy Paste Range
- Execute Macro
- Insert/Delete Columns
- Insert/Delete Rows
- Invoke VBA
- LookUp Range
- Remove Duplicates Range
- Excel Process Scope
- Manage CSV Files
- Filter CSV Files
- Verify CSV Files
- Table Functions
- Manage Multiple Excel Files
- Interpret Excel Results
- Manage Pivot Tables
- Manage Range Selection
- Read From Excel Files
- Manage Databases in Excel
- Compare CSV Files
- Compare Numeric Values
- Sort Data in Excel Files
- Filter and Delete Rows in Excel Files
- Manipulate Range Selections
- Verify Excel Workbook Data
- Read, Write, and Append Data in Excel
- Google Workspace
- Release notes
- About the Google Workspace activities package
- Project compatibility
- Add Attendee
- Create Event
- Delete Event
- Modify Event
- Search Events
- Use Google Drive
- Share File
- Delete File Permission
- Get File Permissions
- Update File Permission
- Copy File
- Create Folder
- Delete File
- Download File
- Find Files and Folders
- Get File Info
- Move File
- Upload File
- Create Document
- Create New Spreadsheet
- Get Mail Messages
- Send Mail Messages
- Change Labels
- Use Google Spreadsheet
- Add Delete Columns
- Add Delete Rows
- Auto Fill Range
- Add New Sheet
- Append Row
- Batch Spreadsheet Updates
- Copy Sheet
- Copy Paste Range
- Delete Range
- Delete Sheet
- Get Cell Color
- Get Sheets
- Read Cell
- Read Column
- Read Range
- Read Row
- Rename Sheet
- Write Cell
- Write Range
- Clear Range
- Download Spreadsheet
- Use Google Document
- Batch Document Updates
- Get Document
- Get Text Index
- Insert Text
- Replace Text
- Read All Text
- Create Script Project
- Get Project Content
- Upload Script File
- Create Deployment
- Run Script
- Mail
- Microsoft 365
- About the Microsoft 365 activity package
- Project compatibility
- Connections
- AddEmailCategories
- ArchiveEmail
- DeleteEmail
- DownloadEmail
- DownloadEmailAttachment
- DownloadEmailAttachments
- ForwardEmail
- GetEmail
- GetEmailAttachmentsInfo
- GetEmails
- GetMailFolders
- GetNewestEmail
- MarkEmailAsRead
- MarkEmailAsUnread
- MoveEmail
- RemoveEmailCategories
- ReplyToEmail
- SendEmail
- TurnOffAutomaticReplies
- TurnOnAutomaticReplies
- Merge multiple sheets into a new summary Excel sheet
- Automatically accept calendar invites from your manager
- Move files to dedicated folders by type
- Verify if new employment documents (I9 and ID) match
- Add new customers to a SharePoint List
- Delete SharePoint List items newer than yesterday
- Notify me on Slack when an important Outlook Email is received
- Include creation date in new OneDrive file names
- Notify me by email when a new file is created
- Microsoft 365 Scope
- Add Sheet
- Append Range
- Clear Range
- Copy Range
- Copy Sheet
- Create Workbook
- Delete Range
- Delete Sheet
- Get Cell Color
- Get Sheets
- Read Cell
- Read Column
- Read Range
- Read Row
- Rename Sheet
- Write Cell
- Write Range
- Set Range Color
- Create Table
- Get Table Range
- Insert Column
- Delete Column
- Insert Rows
- Delete Rows
- VLookup Range
- Use OneDrive & SharePoint
- Copy File/Folder
- Create Folder
- Delete File/Folder
- Download File
- Export File as PDF
- Find Files And Folders
- Get File/Folder
- Move File/Folder
- Upload File
- Share File/Folder
- For Each File/Folder
- Forward Mail
- Get Mail
- Move Mail
- Send Mail
- Reply to Mail
- Delete Mail
- Set Mail Categories
- Add Attachment
- Add Attendee
- Add Location
- Create Event
- Delete Event
- Find Meeting Times
- Get Calendars
- Modify Event
- RSVP
- Search Events
- Create Group
- Delete Group
- Get Group
- List Groups
- Create Bucket
- Delete Bucket
- List Buckets
- List Bucket Tasks
- Create Plan
- Get Plan
- List Plans
- Create Task
- Delete Task
- Get Task
- List Tasks
- Update Task
- For Each List
- Get List Info
- For Each List Item
- Delete List Item
- Add List Items
- Update List Item
- Get List Items
- Presentations
- Release Notes
- About the Presentations activity package
- Project Compatibility
- Add or Update Powerpoint Sensitivity Label
- Add Data Table to Slide
- Add File to Slide
- Add Image or Video to Slide
- Add New Slide
- Add Text to Slide
- Copy Paste Slide
- Delete Slide
- Format Slide Content
- Get Powerpoint Sensitivity Label
- Replace Text in Presentation
- Paste Item Into Slide
- Run Presentation Macro
- Save PowerPoint File As
- Save Presentation as PDF
- Use PowerPoint Presentation
- Word
- Release Notes
- About the Word Activities Package
- Project Compatibility
- Word Application Scope / Use Word File
- Add or Update Word Sensitivity Label
- Add Hyperlink to Document
- Add Picture
- Append Text
- Get Word Sensitivity Label
- Insert DataTable in Document
- Paste Chart/Picture Into Document
- Read Text
- Replace Picture
- Replace Text in Document
- Save Document As
- Save Document as PDF
- Set Bookmark Content
Filter and Delete Rows in Excel Files
.xlsx
file and
how to filter the information by applying specific criteria. It presents activities such
as Remove Data Row, Read Range Workbook or Write Range. You can find these
activities in the UiPath.Excel.Activities package.
.xlsx
file used in the example includes the following columns: Name,
Km, Price, and SellerType. The automation process deletes all
the rows that contain the value Other
and Private
Seller
from the SellerType column and creates a new sheet with the
filtered results.
This is how the automation process can be built:
-
Open Studio and create a new Process named by default Main.
Note: Make sure to add the.xlsx
file that you want to use in the project folder. You can also use the file we provided by downloading the example available at the bottom of this page. -
Drag a Flowchart in the Workflow Designer.
-
Create the following variables:
Variable Name
Variable Type
Default Value
carsList
WorkbookApplication
N/A inputList
System.Data.DataTable
N/A
-
-
Drag an Excel Application Scope activity in the Flowchart and connect it to the Start Node.
- Double click on the Excel Application Scope activity to open it.
- In the Properties panel, add the name
Delete Data
in the DisplayName field. - Add the path of the
.xlsx
file in the WorkbookPath field, in this case,Cars.xlsx
. - Select the check boxes for the AutoSave, CreateNewFile and Visible options. The robot is now allowed to create a new Excel workbook, to automatically save all the changes made to it and to open the Excel file in the foreground while performing actions on it.
- Add the variable
carsList
in the Workbook field.
-
Select the Do sequence inside the Excel Application Scope activity and create the following variable:
Variable Name
Variable Type
Default Value
filterList
System.String[]
{"Private Seller", "Other")
-
Drag an Excel Read Range activity inside the Do sequence.
- In the Properties panel, add the name
"Cars"
in the SheetName field. - Select the AddHeaders check box for considering the first row of the table a header.
- Add the variable
inputList
in the DataTable field.
- In the Properties panel, add the name
-
Place a For Each activity below the Read Range activity.
- Add the value
word
in the ForEach field. - In the Properties panel, select the option
String
from the TypeArgument drop-down list and add the variablefilterList
in the Values field.
- Add the value
-
Select the Body container inside the For Each activity and create the following variables:
Variable Name
Variable Type
Default Value
query
String
RowsToDelete
System.Data.DataRow[]
deletedRows
Int32
-
Drag an Assign activity inside the Do container.
- Add the variable
query
in the To field and the expressionstring.Format("[SellerType]='{0}'", word)
in the Value field. This returns the matching values in the SellerType column and stores them in thequery
variable. Thestring.Format
method is used to convert the DataRow objects that match the filter words to strings.
- Add the variable
-
Drag another Assign activity and place it below the first one.
- Add the variable
RowsToDelete
in the To field and the expressioninputList.Select(query)
in the Value field.
- Add the variable
-
Add a third Assign activity under the first two Assign activities.
- Add the variable
deletedRows
in the To field and the expressionRowsToDelete.Count-1
in the Value field. This creates a counter for the rows that needs to be deleted.
- Add the variable
-
Place a While activity under the Assign activities.
- Insert the expression
deletedRows>=0
in the Condition field. This means that the activities in the Body section are performed until the value of the variabledeletedRows
equals0
.
- Insert the expression
-
Drag a Remove Data Row activity to the Body section of the While activity.
- Add the variable
inputList
in the DataTable field. - Add the expression
RowsToDelete(deletedRows)
in the Row field.
- Add the variable
-
Place an Assign activity below the Remove Data Row activity.
- Add the variable
deletedRows
in the To field and the expressiondeletedRows-1
in the Value field. This creates a loop that is executed until the value of the variabledeletedRows
equals0
.
- Add the variable
- Return to the Flowchart workflow.
-
Drag an Excel Application Scope activity and connect it to the previous Delete Data Excel Application Scope activity.
- Double click on the Excel Application Scope activity to open it.
- In the Properties panel, add the name
Filter Data
in the DisplayName field. - Select the check boxes for the AutoSave and CreateNewFile options. The robot is now allowed to create a new Excel workbook and to automatically save all the changes made to it.
- Add the variable
carsList
in the Workbook field.
-
Drag a Close Application activity inside the Do container of the Excel Application Scope activity.
- Open the
.xlsx
file that you are using for this automation. For this example isCars.xlsx
. - Click on the Options Menu button, select the Indicate on screen option and indicate the
.xlsx
file.
- Open the
-
Drag an Excel Write Range activity below the Close Application activity.
- In the Properties panel, add the name
"Cars2"
in the SheetName field. - Add the variable
inputList
in the DataTable field and the path"Cars.xlsx"
in the WorkbookPath field. - Select the AddHeaders check box for considering the first row of the table a header.
- In the Properties panel, add the name
- Run the process. The automation process deletes the specified data and filters the information in a new workbook sheet.