What are DataTables in UiPath
A DataTable is a type of variable able to store tabular data like an Excel spreadsheet. Similarly to Excel, you can access specific cells, rows, columns, or the entire workbook.
Let's suppose your company saves its employee's data in a single Excel file. Let's take a look at each definition.
Cell: The birthdate of a specific employee
Column: The hiring date of all employees
Row: All the details of a specific employee
Worksheet: All the data for all employees for one company in the group
Workbook: All the data for all employees for all companies in the group
What is the difference between a worksheet and a DataTable?
A DataTable is only a representation of a table which has a collection of columns and rows. It's not possible to visualize that data in a graphical form, only the actual content of each cell. On the other hand, an excel worksheet is the visualization of the data, and you might have different options of work with the graphical user interface.
How to create DataTables
There are several different ways of creating a new DataTable in UiPath. Which one you pick may vary depending on the scenario you are building. Let's take a look at them.
Build Data Table Activity.
Read Range Activities.
Read CSV Activity.
Data Scraping Action.
Generate Data Table From Text Activity.
The Build Data Table Activity
You may use this activity when you want to manually define the column names and data types.
Moreover, you can configure each column with specific options like allow null values, unique values, auto-increment (for numbers), default value and length (for strings).
The Read Range Activities
This activity creates a DataTable based on the input Excel file. You might define a limited Range, or you can leave it blank that UiPath will automatically identify the table where the data is, and create a DataTable for it.
Read CSV Activity
This activity works exactly the same as the previous one Read Range, the only difference is the input file extension. When working with CSV files, you have to use this specific activity.
Data Scraping Action
This UiPath feature enables you to read and extract data from various sources, including web browsers, legacy applications, and documents. You will have to define several settings, including source and selectors. At the end of this activity, you will receive a DataTable with the selected data.
Generate Data Table From Text Activity
This activity can be used to create a DataTable from structured text, by letting the user indicate the row and column separators.
Some other useful activities related to it are Add Data Column, Remove Data Column, Add Data Row, and Remove Data Row. Their names are auto explanatory and they are activities pretty easy to use.
For much more information regarding this topic, please, visit the official documentation at https://docs.uipath.com/studio/docs/data-table-variables.