RPA.Excel.Application

Excel.Application is a library for controlling the Excel application.

Examples

Robot Framework

*** Settings *** Library RPA.Excel.Application Task Setup Open Application Task Teardown Quit Application *** Tasks *** Manipulate Excel application Open Workbook workbook.xlsx Set Active Worksheet sheetname=new stuff Write To Cells row=1 ... column=1 ... value=my data Save Excel Run Excel Macro Open Workbook orders_with_macro.xlsm Run Macro Sheet1.CommandButton1_Click Export Workbook as PDF Open Workbook workbook.xlsx Export as PDF workbook.pdf

Python

from RPA.Excel.Application import Application app = Application() app.open_application() app.open_workbook('workbook.xlsx') app.set_active_worksheet(sheetname='new stuff') app.write_to_cells(row=1, column=1, value='new data') app.save_excel() app.quit_application()

Caveats

This library works on a Windows operating system with UI enabled only, and you must ensure that you open the app first with Open Application before running any other relevant keyword which requires to operate on an open app. The application is automatically closed at the end of the task execution, so this can be changed by importing the library with the autoexit=${False} setting.

*** Settings *** Library RPA.Excel|Outlook|Word.Application autoexit=${False}

If you're running the Process by Control Room through a custom self-hosted Worker service, then please make sure that you enable an RDP session by ticking "Use Desktop Connection" under the Step configuration.

If you still encounter issues with opening a document, please ensure that file can be opened first manually and dismiss any alert potentially blocking the process.

Check the documentation below for more info:

Importing

Initialize the library instance by wrapping the COM Windows app.

param autoexit:Automatically close the app when the process finishes.