Add Worksheet

Adds a new Excel worksheet to a workbook in an established Excel session. Used to create a new worksheet to be added to an Excel document that was previously created using the Create Workbook action or opened using the Open Workbook action.

Declaration

<AMEXCELADDWORKSHEET SESSIONNAME="text" WORKSHEETNAME="text" LASTWORKSHEET="yes/no" TEMPLATENAME="text">

See Also: Excel Actions Example, Create Workbook, Open Workbook, Close Workbook, Activate Worksheet, Get Cell, Set Cell, Cells to Dataset, Dataset to Cells

AWE's Excel actions use Microsoft's Excel automation engine to perform their work. Therefore, Microsoft Excel must be licensed and installed on the system in order 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 action is only useful in conjunction with other Excel actions. It is not possible to use AWE's Excel actions on a spreadsheet that was not opened by the Open Workbook action or created by the Create Workbook action.

General Tab

Property

Type

Required

Default

Markup

Description

Session Name

Text

Yes

ExcelSess1

SESSION="ExcelSess7"

The name of the session to associate with this Excel action. Numerous sessions can exist within a single task allowing several spreadsheets to be open simultaneously. If working with only one document, this can remain at the default name, which is Excelsess1.

Worksheet Name

Text

Yes

(Empty)

WORKSHEETNAME="c:\file.xls"

The path and file name of the new worksheet that will be created.

NOTE: Any subsequent actions performed on the worksheet will be saved to memory. The file will not be changed on the hard disk until it is saved either manually or with the use of the Close Workbook action (with the Do not save changes parameter disabled).

Insert before / Add worksheet at the end

Yes/No

No

No

LASTWORKSHEET="yes"

If Insert worksheet before active one is enabled, the new worksheet will be added before the currently active worksheet. If Add worksheet at the end is enabled, the worksheet will be added after the active worksheet. when working with the workbook, the Microsoft Excel Window will not be displayed (processing will occur in the background). Usually this option should be left unchecked when building/debugging, but enabled for production.

Sheet Type

Text (options)

No

Worksheet

SHEETTYPE="chart"

The type of worksheet that should be added. The available options are:

  • Worksheet (Default) - A new blank worksheet will be added to the workbook.

  • Chart - A new chart will be added to the workbook.

  • Macro - A new macro will be added to the workbook.

  • Dialog - A new dialog will be added to the workbook.

  • Specific template: A new template should be used when adding a worksheet to the workbook.

Template Name

Text

No

(Empty)

TEMPLATE="c:\mytemplate.xlt"

The path and file name of a template that should be used when adding the worksheet. Excel Templates have the file extension.xlt. This parameter is available only if Specific template is selected from the Sheet Type parameter.