activities
latest
false
UiPath logo, featuring letters U and I in white
Productivity Activities
Last updated Nov 21, 2024

Quickstart - Find, Create, and Add

The purpose of this guide is to help you create a working sample that uses different Microsoft 365 activities, including the Find Files and Folders, Create Workbook, Add Sheet, and Get Sheets activities.

Prerequisites

Before you begin:

  1. Complete the Microsoft 365 steps.
  2. Create or use an existing folder in your OneDrive. You'll use this folder to store the workbook you create in the steps below.

    • You can create a new folder manually or follow the Create, Write, Read Quickstart guide.

Steps

Build your project
  1. Add the Microsoft Office 365 Scope activity to your project.
  2. Enter the ApplicationId for your registered application (for more information, see the guide).
  3. From the AuthenticationType drop-down list, select the applicable type (e.g., InteractiveToken).

    • If you select InteractiveToken and run the sequence while you're present, you don't need to add a Password, Tenant, or Username in the Unattended section (leave empty).
  4. From the Services drop-down list, select, at a minimum,Files.
  5. Add the Find Files and Folders activity after the Microsoft Office 365 Scope activity.
  6. Enter a Query (e.g., the folder name) to find the folder that you created, or are using, from step 2 in the prerequisites above (e.g., "Quickstarts").
  7. Create and enter a DriveItem variable for your First value (e.g., firstResult).
    • When creating your variable, select Microsoft.Graph.DriveItem as the variable type.
    • When your Query is specific, with no chance of finding more than one result, you can use the First output property only. When your Query is less specific you can add a DriveItem[] variable for your Results value to return all folders that meet the query parameters.
  8. Add the Create Workbook activity after the Find Files and Folders activity.
  9. Create and enter a String variable for your Name value (e.g., workbookName).
  10. In the Parent property, enter the DriveItem variable you created for the Find Files and Folders activity (e.g. firstResult)
  11. Create and enter a DriveItem variable for your Workbook value (e.g., newWorkbook).
  12. Add the Add Sheet activity after the Create Workbook activity.
  13. Create and enter a String variable for your Sheet value (e.g. sheetName_).
  14. In the Workbook property, enter the DriveItem variable you created for the Create Workbook activity (e.g. newWorkbook).
  15. To indicate when the robot finishes the first set of activities, add the Message Box activity after the Add Sheet activity.
  16. Enter a String message (e.g., "Created "+workbookName+" and added "+sheetName).
Test your project
  1. Test that your new sheet was added to the created workbook, add the Get Sheets activity after the Add Sheet activity.
  2. In the Workbook property, enter the DriveItem variable you created for the Create Workbook activity (e.g. newWorkbook).
  3. Create and enter a String[] variable for your Sheets value (e.g., workbookSheets).
  4. Verify your sheet was found by adding a Write Line activity after the Get Sheets activity.
  5. In Text property, enter a message that includes the String[] variable you created for the Sheets property (e.g., "Verified "+workbookSheets(1)+" was added!").
    • Because the variable is an array, you must specify the item you want to output by appending an integer value at the end (e.g., (1)).
    • In this example, you want to return the 2nd sheet from the workbook because the Add Sheet activity adds the new sheet at the end of existing sheets - when the new workbook the first sheet (i.e., "Sheet 1") was added by default.
  6. Click Run and verify that the Write Line activity includes the correct values to the Output panel (e.g., AddSheetExample).

When you're ready, try the other Quickstart guides to get more familiar with the different Microsoft 365 activities.

How it works

After completing the steps in this guide, you'll have an automation sequence that does the following:

  1. Establishes a connection to your registered Microsoft 365 application (Microsoft Office 365 Scope).
  2. Finds an existing folder in your OneDrive to store a new workbook (Find Files and Folders).
  3. Creates a new workbook in the found OneDrive folder (Create Workbook).
  4. Adds a new sheet to the newly created workbook (Add Sheet).
  5. Tells you when the workbook and sheet have been created (Message Box) activity.
  6. Tests that your new sheet was added (Get Sheets and Write Line).



  • Prerequisites
  • Steps
  • How it works

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.