Example: Using Excel Actions
AWE's Excel actions use Microsoft's Excel automation engine to perform their work. Therefore, Microsoft Excel must be licensed and installed on the EFT computer for these actions to work. Excel objects run in the context of the user executing them. If EFT is running as a Local System, then the Excel object is executed using the Local System profile. Before using an Excel action in Event Rules, refer to Globalscape Knowledgebase article #11089 for important information.
This example demonstrates the use of various Excel actions:
<AMEXCELCREATEWORKBOOK WORKBOOK="c:\sampledoc.xls" OVERWRITE="YES" /> <AMEXCELADDWORKSHEET WORKSHEETNAME="My New Sheet" LASTWORKSHEET="YES" /> <AMEXCELACTIVATEWORKSHEET WORKSHEET="My New Sheet" /> <AMEXCELSETCELL NEWVALUE="Set this data here" CELLROW="1" CELLCOLUMN="1" /> <AMPAUSE ACTION="waitfor" SCALAR="3" /> <AMEXCELSETCELL NEWVALUE="and this here" CELLROW="2" CELLCOLUMN="1" /> <AMPAUSE ACTION="waitfor" SCALAR="3" /> <AMEXCELCLOSEWORKBOOK SAVE="NO" />
Below is a description of each step of the task, including the action used and details about that action:
-
Create Workbook Action - Create new Excel workbook "C:\Temp\sampledoc.xls." Overwrite file if it already exists.
-
Add Worksheet Action - Add new Excel worksheet "My New Sheet" to workbook open in session "ExcelSess1." New worksheet will be the last one of the workbook.
-
Activate Worksheet Action - Activate Excel worksheet "My New Sheet" in workbook open in session "ExcelSess1."
-
Set Cell Action - Write text "Set this data here" in Excel cell located at row:1 and column:1.
-
Pause Task Action - Pause task for 3 seconds.
-
Set Cell Action - Write text "and this here" in Excel cell located at row:2 and column:1.
-
Pause Task Action - Pause task for 3 seconds.
-
Close Workbook Action - Close Excel workbook. Do not save workbook before closing.