🧹 One-Line LINQ Code to Remove Empty Excel Rows in UiPath! ⚡📊
Автор: Gravity Automation
Загружено: 2025-05-08
Просмотров: 42
Описание:
In this video, learn how to use a powerful one-line LINQ query in UiPath to remove empty rows from an Excel DataTable. This VB.NET trick helps you clean your data fast and efficiently — no loops needed!🚀
📌 Perfect for RPA developers looking to optimize Excel automation in UiPath.
🧩 Step-by-Step Breakdown:
ExcelData.AsEnumerable()
Converts the DataTable (ExcelData) into a collection of DataRows so you can use LINQ.
.Where(Function(row) ...)
Filters the rows based on the condition inside. Only the rows that satisfy the condition will be kept.
row.ItemArray
Gets all column values from the current row as an array (Object()).
.Any(Function(field) Not String.IsNullOrWhiteSpace(field.ToString()))
Checks if any field (cell) in the row is not empty or not just whitespace.
If at least one column has data, the row is kept.
If all columns are empty, the row is excluded.
.CopyToDataTable()
Converts the filtered rows back into a new DataTable.
This one-line LINQ code checks each row in the DataTable and keeps only the rows where at least one cell is not empty or whitespace. It filters out all the completely blank rows and returns a clean DataTable.
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: