Using the Open action for Excel advanced

Use the Open action to open a Microsoft Excel spreadsheet or a CSV file.

Open action enables you to specify if the spreadsheet must open in read-only mode, read-write mode, requires a password to open the spreadsheet, and so on.

When you use the Open action to open a macro-enabled Excel workbook of .xlsm format, the Auto_Open VBA procedure does not run automatically because the VBA procedure runs only when the Excel workbook is opened manually. This is a default behavior of Microsoft Excel. See Behavior difference between Workbook_Open and Auto_Open procedure.

Note: You can use wildcard pattern based search to open an existing excel file that matches the search criteria. For example, if you have multiple files with similar names such as table1.xlsx, table2.xlsx, table3.xlsx, you can open the file by specifying the (*) wildcards in the file path as table*.xlsx to open the first file that matches the pattern.

Procedure

  1. Double-click or drag the Open action from the Excel advanced package in the Actions palette.
  2. Select from where you want to open the Microsoft Excel spreadsheet:
    • File: Select one of the following options to open a Microsoft Excel spreadsheet:
      • Control Room file: Enables you to open a file from the Control Room.
      • Desktop file: Enables you to open a file from the device. This field also accepts the file path input as a string variable or global value.
        Note: In the Desktop file field, if you enter a file path or browse to a particular file from the system and if the file path is separated by the backslash (\) characters, when you save the bot, the backslash characters are changed to slash (/) characters because the bot uses slash characters to separate file paths. Your bots continue to run successfully even if the backslash characters are is changed to slash characters during bot run.
      • Variable: Enables you to open a file by specifying a file variable.
    • SharePoint: In the File path field, enter the exact file path of the Excel spreadsheet on SharePoint.
      To copy the URL of the Excel spreadsheet from SharePoint, perform the following steps:
      • Open the Microsoft Excel spreadsheet on SharePoint.
      • In the Microsoft Excel spreadsheet, navigate to File > Info.
      • Click Copy path.
      Note: Time taken to access files from a SharePoint folder depends on your network speed and the size of the file.
  3. Select the Sheet contains a header check box if the Microsoft Excel spreadsheet contains a header row.
  4. Select the Specific sheet name option and specify the name of the sheet to activate when the Microsoft Excel spreadsheet opens.
  5. Select Read-only mode or Read-write mode to open the Microsoft Excel spreadsheet in read-only or edit mode respectively.
  6. Select the Password is required check box if a password is required to open or edit the Microsoft Excel spreadsheet.
  7. Select the Load Add-ins check box if you want to load the add-ins available in the Microsoft Excel spreadsheet.
  8. Select the Exclude hidden sheets check box if you want to ignore the excel sheets that are hidden and do not want to perform any operation on those hidden sheets.
  9. Select any of the following tabs to create an Excel session:
    • Local session: Specify a session name that can be used only in the current bot.
    • Global session: Specify a session name that can be used across multiple bots, such as parent bots, child bots, and other child bots of the parent bots .
      You can also use the Global session option to loop through each row in an Excel advanced worksheet.
      Note: You can open an Excel worksheet by using the Global session option and use it across multiple bots without having to share the session by using the Set session variable action.
      You can also close the session from the child bot when you are using the Global session option and sharing the session across child bots.
      Important: If you close the session from the child bot and run the parent bot, then in the parent bot, the actions that come after the child bot are not run, and the bot fails with an error because the session has already been closed from the child bot.
    • Variable: Specify a session variable that can be used to share that session with other child bots.
    Note: When you use more than one workbook to automate an operation, you must use different session names for each workbook. If you want to use the same session name to automate all the workbooks, you must first close the session of one workbook before using the same session name for another workbook.
  10. Click Save.