# Read Range

> `UiPath.MicrosoftOffice365.Activities.Excel.ReadRange`

`UiPath.MicrosoftOffice365.Activities.Excel.ReadRange`

## Description

Uses the Microsoft Graph [Get range](https://docs.microsoft.com/en-us/graph/api/range-get?view=graph-rest-1.0&tabs=http) API to retrieve values from a specified range of cells (**Range**) in a workbook (**Workbook**) worksheet (**SheetName**). After retrieving the range of cell data, the activity outputs the values into a `DataTable` (**DataTable**).

### Scopes

This activity requires the following scopes:

* Sites.Read.All

OR

* Sites.ReadWrite.All

## Project compatibility

Windows - Legacy | Windows

## Configuration

**Properties**

#### Common

* **DisplayName** - The display name of the activity. This property supports `String` variables and string formatted values.

#### Input

* **Range** - The range of cells to read. If no range is specified, the whole sheet is read. Enter your range of cells in A1-style notation (e.g., *"A1:A5"*). This property supports `String` variables and string formatted values.
* **Sheet Name** - The name of the sheet from which data is read. This property supports `String` variables and string formatted values.
* **Workbook** - The `DriveItem` whose data is read. This object can be retrieved using the [Find Files And Folders](https://docs.uipath.com/activities/other/latest/productivity/office365-find-files-and-folders) activity. Use the output property variable from either the **Find Files and Folders** (**First** or **Results**) or [Create Workbook](https://docs.uipath.com/activities/other/latest/productivity/office365-create-workbook) (**Workbook**) activities. When using the **Results** output property from the **Find Files and Folders** activity, be sure to specify which item in the array that you want to use (e.g., *myWorkbooks(0)*).

#### Misc

* **Private** - If selected, the values of variables and arguments are no longer logged at Verbose level. This field supports Boolean values.

#### Options

* **Add Headers** - If selected, the first row from the range is added sd column headers in the **DataTable**. This field supports Boolean values.
* **Value Type** - The type of data that is read from the document. Use the drop-down list to select one of the three options:
  + **Values** - Default. Retrieves the coded value (i.e., backend) of the cells in the row. This might differ from the format value shown in the Excel worksheet (e.g., if the cell displays 23.00 in the worksheet, the coded value returned is 23).
  + **Formulas** - Retrieves the formula of the specified cell only (e.g., *=SUM(A1,B1)*). If you select **Formulas** and the specified cell doesn't contain a formula, the returned value defaults to **Values**.
  + **Text** - Retrieves the Excel worksheet value of the cell (e.g., if the cell displays 23.00 in the worksheet, the text value returned is 23.00).

#### Output

* **DataTable** - The result of the read. This field supports only `DataTable` variables. Required if you plan to use the output data in subsequent activities. To get the **DataTable** contents, use an activity that has a `DataTable` input property (e.g., [Output Data Table](https://docs.uipath.com/activities/other/latest/user-guide/output-data-table), [For Each Row](https://docs.uipath.com/activities/other/latest/user-guide/for-each-row), [Append to CSV](https://docs.uipath.com/activities/other/latest/productivity/append-csv-file), etc.).

## How it works

The following steps and message sequence diagram is an example of how the activity works from design time (i.e., the activity dependencies and input/output properties) to run time.

1. Complete the steps.
2. Add the [Microsoft Office 365 Scope](https://docs.uipath.com/activities/other/latest/productivity/microsoft-office-365-scope) activity to your project.
3. Add an activity or run an external process that outputs a `DriveItem` object (e.g., [Find Files and Folders](https://docs.uipath.com/activities/other/latest/productivity/office365-find-files-and-folders), [Create Workbook](https://docs.uipath.com/activities/other/latest/productivity/office365-create-workbook), [Copy Item](https://docs.uipath.com/activities/other/latest/productivity/office365-copy-item)).
4. Add the **Read Range** activity inside the **Microsoft Office 365 Scope** activity.
5. Enter values for the Input properties.
6. Create and enter a `DataTable` variable for the Output property.
7. Run the activity.
   * Your input property values are sent to the [GetRange](https://docs.microsoft.com/en-us/graph/api/range-get?view=graph-rest-1.0&tabs=http) API.
   * The API returns the `DataTable` value to your output property variable.

![docs image](https://dev-assets.cms.uipath.com/assets/images/activities/activities-docs-image-180176-2dceac62.webp)
