Create Office File

Creates a Word, Excel, or PowerPoint Office file and returns the process ID and application.

Command availability: IBM RPA SaaS and IBM RPA on premises

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

officeCreate --type(OfficeApplicationType) [--path(String)] [--keepvisible(Boolean)] (OfficeApplication)=officeapplication (Numeric)=processid

Dependencies

  • Microsoft™ Office 2010 or higher is required.
  • Ensure that the architecture (bitness) of your Office apps, IBM RPA, and your operating system match. For example, if you are using a 64-bit operating system, IBM RPA and Office must be 64-bit too.

Input parameters

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
Type type Required OfficeApplicationType Office file type.
Template File path Optional Text Full path to an Office file that is used as a template for the new file.
Keep Visible keepvisible Optional Boolean Option to keep the file visible while being used.

Output parameters

Designer mode label Script mode name Accepted variable types Description
Office Application officeapplication Office Application Variable that stores the created Office application.
Process ID processid Number Process ID of the created Office file.

Example

The Create Office File command creates an Excel file, saves it, and then returns the process ID and application.

defVar --name officeApplication --type OfficeApplication
defVar --name processID --type Numeric
defVar --name path --type String
defVar --name desktopPath --type String
defVar --name excelPath --type String
// Create the Excel spreadsheet.
officeCreate --type "Excel" officeApplication=officeapplication processID=processid
getSpecialFolder --folder "Desktop" desktopPath=value
// Save the spreadsheet to the desktop.
officeSaveAs --filepath "${desktopPath}" --filename ModeloOffice --fileformat "Default" --officeapplication ${officeApplication} excelPath=value
logMessage --message "ID: ${processID}" --type "Info"
// Result:Process ID.

Limitations

The Office file type must be the same for the Template File and type parameters