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

Quickstart - Create, Write, and Read

The purpose of this guide is to help you create a working sample that uses different Microsoft 365 activities, including the Create Folder, Create Workbook, Rename Sheet, Write Range, and Read Range activities.

Prerequisites

Before you begin:

  1. Complete the Microsoft 365 steps.

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 Files (you can select the other services as well).
  5. Add the Create Folder activity after the Microsoft Office 365 Scope activity.
  6. Enter a Name for the folder (e..g, "Quickstarts").
  7. In the ParentDirectory property, enter the directory where this folder will be created.

    • If you want to create the folder in your root directory (like we do in this example), leave this property empty.
  8. Create and enter a DriveItem variable for your Folder value (e.g., newFolder).
    • When creating your variable, select Microsoft.Graph.DriveItem as the variable type.
  9. Add the Create Workbook activity after the Create Folder activity.
  10. Create and enter a String variable for your Name value (e.g., workbookName).
  11. In the Parent property, enter the DriveItem variable you created for the Create Folder activity (e.g. newFolder)
  12. Create and enter a DriveItem variable for your Workbook value (e.g., newWorkbook).
  13. Add the Rename Sheet activity after the Create Workbook activity.
  14. Enter a NewSheetName (e.g., "DisneyCharacters").
  15. Enter the Original Sheet Name (e.g., "Sheet1").
  16. In the Workbook property, enter the DriveItem variable you created for the Create Workbook activity (e.g. newWorkbook).
  17. Add the Build Data Table activity after the Rename Sheet activity.
  18. Click the DataTable button in the activity to open the Build Data Table wizard.
  19. Enter at least two columns and two rows of data (for an example, see the image below).
  20. Create and enter a DataTable variable for your DataTable value (e.g., disneyCharacters)
  21. Add the Write Range activity after the Build Data Table activity.
  22. Enter the DataTable variable you created for the Build Data Table activity (e.g., disneyCharacters).
  23. Enter the SheetName you entered for the Rename Sheet activity (e.g., "DisneyCharacters").
  24. Enter the StartingCell (e.g., "A1").
  25. In the Workbook property, enter the DriveItem variable you created for the Create Workbook activity (e.g. newWorkbook).
  26. To indicate when the robot finishes the first set of activities, add Write Line activity after the Rename Sheet activity.
  27. Enter a String message (e.g., "Finished creating: "+folderName+" folder, "+workbookName+" workbook, and "+sheetName+" worksheet!").
Test your project
  1. To verify that your DataTable was written to your worksheet, add the Read Range activity after the Write Line activity.
  2. Enter a valid Range (e.g., "A2:B6").
  3. In the SheetName property, enter the name from the Rename Sheet activity (e.g., "Disney Characters").
  4. In the Workbook property, enter the DriveItem variable you created for the Create Workbook activity (e.g. newWorkbook).
  5. Select Add Headers (this can be useful if you plan to output the data table to a new).
  6. Create and enter a DataTable variable for your DataTable value (e.g., verifiedDisneyCharacters)
  7. To see the output values, add the Output Data Table activity after the Read Range activity.
  8. In the DataTable property, enter the DataTable variable you created for the Read Range activity (e.g., verifiedDisneyCharacters).
  9. Create and enter a String variable for the Text property (e.g., datatableOutput).
  10. Add another Write Line activity after the Output Data Table activity.
  11. Enter the String variable you created for the Output Data Table activity as your Text property value (e.g., datatableOutput).
  12. Click run and verify the results in the output window.

When you're ready, try the other Quickstart guides to get more familiar with the different Microsoft Office 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. Creates a new folder in your OneDrive to store a new workbook (Create Folder).
  3. Creates a new workbook in the new folder (Create Workbook).
  4. Renames the default "Sheet1" in the new workbook (Rename Sheet).
  5. Builds a new DataTable object to write to the worksheet (Build Data Table).
  6. Writes the created DataTable to the worksheet (Write Range).
  7. Verifies the Write Range activity by reading back the values (Read Range and Output Data Table).



  • 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.