# Get Sheets

> `UiPath.MicrosoftOffice365.Activities.Excel.GetSheets`

`UiPath.MicrosoftOffice365.Activities.Excel.GetSheets`

## Description

Uses the Microsoft Graph [Get worksheet](https://docs.microsoft.com/en-us/graph/api/worksheet-get?view=graph-rest-1.0&tabs=http) API to retrieve and return an array of worksheets (**Sheets**) from a specified workbook (**Workbook**).

### Scopes

This activity requires the following scopes:

* Files.Read

OR

* Files.ReadWrite

OR

* Files.Read.All

OR

* Files.ReadWrite.All

OR

* 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

* **Workbook** - The `DriveItem` of the Excel document whose sheets are returned. 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.

#### Output

* **Sheets** - The sheets from the workbook as an array of strings. This field supports only `String[]` variables. Required if you plan to use the output data in subsequent activities.

## 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 **Get Sheets** activity inside the **Microsoft Office 365 Scope** activity.
5. Enter values for the Input properties.
6. Create and enter a `String[]` variable for your Output property.
7. Run the activity.
   * Your input property values are sent to the [GetWorksheet](https://docs.microsoft.com/en-us/graph/api/worksheet-get?view=graph-rest-1.0&tabs=http) API.
   * The API returns the `String[]` value to your output property variable.

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