Robot Task Activities - Excel Workbook
The Excel Workbook activities create, open, save, close, protect and inspect Excel workbooks.

All activities in this category must be inside a New Excel or Attach to Excel container activity. See Excel. A Workbook field takes the name of an open workbook, such as Workbook1.xlsx, matched exactly; an activity fails if that workbook is not open. Variables are resolved in every field.
Selecting a workbook: on activities that take a workbook name, click the Click to select Excel element link, then select the workbook, hold CTRL and click. The workbook name is filled in automatically. Excel must already be running.

Activate Workbook
Makes the workbook the active workbook.

- Workbook: the name of the open workbook
Open Workbook
Opens a workbook file.
- File name: the full path of the workbook file
Close Workbook
Closes the workbook. Same field as Activate Workbook.
Close Workbook does not save the workbook. With DisplayAlerts cleared on the parent container, which is the default, Excel does not ask about unsaved changes, and they are lost. Save the workbook first with Save Workbook or Save as Workbook.
Close Workbooks
Closes all workbooks in the Excel application, without saving them, in the same way as Close Workbook.
Unsaved changes in every workbook of that Excel application are lost without a prompt. Inside Attach to Excel, this includes workbooks that someone else opened in the session.
Create Workbook
Creates a new, empty workbook, which becomes the active workbook.
Save Workbook
Saves the workbook to its current file. Same field as Activate Workbook.
Save as Workbook
Saves the workbook to a new file. The workbook then belongs to the new file.

- Workbook: the name of the open workbook to save
- File name: the full path of the new file
- File format: "Default" (Excel's default save format), "CSV", "XLS" or "XLSX"
With DisplayAlerts cleared on the parent container, which is the default, Excel does not ask before it replaces an existing file at File name. Use a unique file name for each run, or check first with a File File Exists activity.
Save copy as Workbook
Saves a copy of the workbook to a file. Same Workbook and File name fields as Save as Workbook, without File format.
The difference from Save as Workbook is that the open workbook stays connected to its original file, so later saves go to the original path rather than to the copy.
Protect Workbook
Protects the structure of the workbook, so that sheets cannot be added, deleted, moved or renamed without the password.

- Workbook: the name of the open workbook to protect
- Password: the password needed to remove the protection
Protect Workbook does not encrypt the file or set a password to open it, and it does not protect the cells. Use Excel Sheet Protect Sheet to protect cells.
Unprotect Workbook
Removes the protection from the workbook. Same fields as Protect Workbook.
Print Workbook
Prints the workbook on the default printer of the user the Robot Task runs as. Same field as Activate Workbook.
Zoom Workbook
Sets the zoom level of the workbook's windows.

- Workbook: the name of the open workbook
- Zoom: the zoom percentage
Freeze Workbook Panes
Freezes the panes of the workbook's windows. Same field as Activate Workbook.
Unfreeze Workbook Panes
Unfreezes the panes of the workbook's windows. Same field as Activate Workbook.
Get Info Workbook
Reads one item of information about the workbook and saves it to a Job or User Variable. The workbook is activated first.

- Workbook: the name of the open workbook
- Info: the name of the item to read; type it, or click Select to choose from the supported names
- Variable type: "Job" or "User"
- Variable: the name of the Variable that receives the value
The supported names are WorkbookName, Author, Title, Subject, Comments, Category, Keywords, Manager, Company, HyperlinkBase, IsProtected, SheetCount, ZoomPercentage, ActiveSheetName and ActiveSheetIndex, and, for the used range of the active sheet, RowCount, ColumnCount, FirstRowNumber, LastRowNumber, FirstColumnNumber, LastColumnNumber, FirstColumnLetter and LastColumnLetter. Names must be typed exactly as shown; any other name makes the activity fail. IsProtected reports whether the workbook's windows are protected, not its structure.
Tips
- Use a Variable in the File name of a Save as Workbook activity so that each run produces a separate file, for example
C:\Logs\{JOB(Active|Name)}_Exceptions_{DATEFORMAT(yyyy-MM-dd)}.xlsx - Follow Save as Workbook with Close Workbook and then Quit Excel, so that the file is released and no Excel process is left behind
- Use
LastRowNumberfrom Get Info Workbook to find the next free row before you append to a sheet - Close Workbooks inside a New Excel container is a safe cleanup step. Do not use it inside Attach to Excel unless every open workbook can be discarded, because it closes them all without saving