Get Cell Action

Declaration

<AMEXCELGETCELL SESSIONNAME="text" RESULTVARIABLE="text" CELLROW="text" CELLREF="text" CELLCOLUMN="text" WORKSHEET="text">

See Also

Create Workbook, Open Workbook, Close Workbook, Add Worksheet, Activate Worksheet,  Set Cell, Cells to Dataset, Dataset to Cells

Description

Returns the text contained in a selected cell in an established Excel session.

Practical Usage

To retrieve the contents of a cell in a Microsoft Excel document that was previously created or opened using AutoMate's Excel actions. This action is only useful in conjunction with the other Excel actions found in AutoMate.

IMPORTANT: The Excel actions in AutoMate use the Microsoft Excel automation engine to perform their work. Because of this, Microsoft Excel must be licensed and installed on the system to use the Excel actions.

Parameters

General Tab

Session Name

Text, Optional - Default "Default"
MARKUP: SESSION="YES"

Specifies the session name to identify which document should be changed from prior Excel steps. This allows several Excel files to be open simultaneously. If working with only one document, this value should not be changed from it's default value.

Populate Variable

Variable, Required
MARKUP: RESULTVARIABLE="VARNAME"

Specifies name of the AutoMate variable that should be populated with the contents of the desired cell at runtime.

Row

Text, Optional Default ""
MARKUP: CELLROW="3"

Specifies the row of the cell where the data should be retrieved. If specified, CELLCOLUMN must also be specified.

Column

Text, Optional Default ""
MARKUP: CELLCOLUMN="2"

Specifies the column of the cell where the data should be retrieved. If specified, CELLROW must also be specified.

Cell Reference

Text, Optional Default ""
MARKUP: CELLREF="B3"

Specifies the reference of the cell where the data should be retrieved. This is an alternate method to specifying the row and column of the desired cell.  If specified, CELLROW and CELLCOLUMN are ignored.

Worksheet Name

Text, Optional Default ""
MARKUP: WORKSHEET="My Worksheet Name"

Specifies the name of the new worksheet that the text will be retrieved from. If left blank or omitted, the current active worksheet will be used.

Notes

Custom Description

This action includes the Description tab for entering a custom step description.

More on setting custom step description

Standard Error Handling Options

This action also includes the standard Error Causes and On Error failure handling options/tabs.

More on Error Handling Options

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.

More on variables
More on expressions

More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

<AMVARIABLE NAME="myvariable"></AMVARIABLE>

     <AMEXCELOPENWORKBOOK WORKBOOK="c:\excellfile.xls">

     <AMEXCELADDWORKSHEET WORKSHEETNAME="My New Sheet" LASTWORKSHEET="YES">

     <AMEXCELACTIVATEWORKSHEET WORKSHEET="My New Sheet">

     <AMEXCELSETCELL NEWVALUE="Set this data here" CELLROW="1" CELLCOLUMN="1">

     <AMEXCELSETCELL NEWVALUE="and this here" CELLROW="2" CELLCOLUMN="1">

     <AMEXCELGETCELL RESULTVARIABLE="myvariable" CELLREF="a2">

<AMEXCELCLOSEWORKBOOK>