Export Office File As
Exports the contents of an Office file and returns it to an "XPS" or "PDF" file.
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.
officeExportAs --filepath(String) --filename(String) --fileformat(OfficeExportFormat) --quality(OfficeExportQuality) [--location(String)] --officeapplication(OfficeApplication) (String)=value
Dependencies
-
To use this command, open an Office file with the Open Office file (
officeOpen
) command. -
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 |
---|---|---|---|---|
Path | filepath |
Required |
Text |
Directory to save the exported file. |
File Name | filename |
Required |
Text |
Name of the exported file. |
Format | fileformat |
Required |
OfficeExportFormat |
Format to export the file to. See the fileformat parameter options. |
Quality | quality |
Required |
OfficeExportQuality |
Quality of file to be exported. See the quality parameter options. |
Locations | location |
Optional |
Text |
Defines specific locations within the file to export. |
Office Application | officeapplication |
Required |
Office Application |
Variable that holds the Office file instance. |
fileformat
parameter options
The following table displays the options available for the fileformat
input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
Designer mode label | Script mode name | Description |
---|---|---|
PDF |
Matches the PDF file format. | |
XPS | XPS |
Matches the XPS file format. |
quality
parameter options
The following table displays the options available for the quality
input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
Designer mode label | Script mode name | Description |
---|---|---|
Standard | Standard |
Maintains the original file size without changing the quality. |
Minimum | Minimum |
Decreases the size of the original file and might have its quality affected. |
Output parameters
Designer mode label | Script mode name | Accepted variable types | Description |
---|---|---|---|
Path | value | Text |
Returns the full path of the file with the exported content. |
Example
The Open Office File command opens a file and stores it in a variable. The Export Office File As command uses this variable to export the contents of the file to the new file "table2", except at a specified location.
defVar --name officeApplication --type OfficeApplication
defVar --name filePath --type String
officeOpen --path "Sample File" --type "Excel" --keepvisibleofficeApplication=officeapplication
officeExportAs --filepath "Enter the path where the file will be exported." --filename file name --fileformat "PDF" --quality "Standard" --location "sheet1 " --officeapplication ${officeApplication} filePath=value
officeClose --officeapplication ${filePath}
❕ Important: To use the sample script, use a sample file and enter its path in the File Path
parameter of the Open Office File command.