OpenDocument Spreadsheet - Close workbook
Declaration
<AMODS ACTIVITY="close_workbook" SESSION="text" SAVETYPE="text (options)" DESTINATION="text" OVERWRITEDESTINATION="YES/NO" />
Description
Closes a workbook previously opened or created by the OpenDocument Spreadsheet - Open/Create workbook activity and ends the associated session.
Practical usage
Mainly used to save and close a spreadsheet document that was modified with prior ODS steps and ends the associated session.
Parameters
Session
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Session | Text | Yes | OPENDOCSession1 | SESSION="mySession" | The session name to identify which document should be closed from prior Excel steps. Numerous sessions can exist within a single task allowing several Excel documents to be open simultaneously. |
On completion | Text (options) | No | Save |
|
Specifies
what to do with the document upon completion of this activity.
The available options are:
|
File | Text | Yes, if On completion is set to Save as | (Empty) | DESTINATION="c:\temp\dest.xls" | The path and file name of the file in which changes will be saved. Click the folder icon to open a standard Explorer dialog in order to navigate to the desired file or simply enter the path and file name in the provided text box. This parameter is only active if On completion is set to Save as. |
Overwrite if workbook already exists | Yes/No | No | No | OVERWRITEDESTINATION="YES" | If selected, the saved workbook will overwrite any workbook with the same name that exists in the destination. If disabled (default), an existing workbook with the same name will not be overwritten, however, an error will occur during runtime as a result of matching file names. This parameter is only active if On completion is set to Save as. |
Example
- Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
- To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.
Description
This sample task opens a workbook, populates a dataset with data regarding the spreadsheets that it contains. The dataset is then looped. During each iteration, information about the current spreadsheet is displayed in a message dialog. The last step closes the workbook, ths ending the session.
<AMODS SESSION="OPENDOCSession1" WORKBOOK="C:\temp\Employees.xls" />
<AMODS ACTIVITY="list_worksheet" SESSION="OPENDOCSession1" RESULTDATASET="theSheets" />
<AMLOOP ACTIVITY="dataset" DATASET="theSheets" />
<AMSHOWDIALOG WINDOWTITLE="Worksheet Information">Worksheet Name: %theSheets.WorksheetName%Worksheet Index: %theSheets.WorksheetIndex%Is worksheet visible?: %theSheets.IsVisible%Is worksheet active?: %theSheets.IsActive%</AMSHOWDIALOG>
<AMLOOP ACTIVITY="end" />
<AMODS ACTIVITY="close_workbook" SESSION="OPENDOCSession1" />