Workbook Class (Component)

The Workbook allows you to read and write values to cells from a specified Excel workbook and spreadsheet that may be used in EasyLanguage analysis techniques and strategies. Microsoft Excel is required to successfully run this component.

Typically, you will use the Toolbox to add a component to your EasyLanguage document.  Click and drag the name Workbook into your document from the Toolbox.  By default, the name of the Workbook appears in the component tray at the bottom of your document followed by a number (to help identify multiple instances of the component).

The file name and full path of the Excel file are entered using the FileName property. The Excel file must exist before the analysis technique or strategy is run.

Individual cells are addressed in the form [column, row]. For example, to import string cell data from the third column, fourth row of the left-most tabbed worksheet into RadarScreen use

plot1(workbook1.sheets[1].CellsAsString[3,4]);

Specific Excel workbook sheets may be addressed using an index number to reference the tabbed sheets from left to right.  The far left tab is sheet 1; the next one to the right is 2, etc.  For example, a cell in sheet 2 is assigned a string value.

workbook1.sheets[2].CellsAsString[3,3]= "Data11";

Excel workbook sheets may also be addressed using the exact tab name of the spreadsheet.

workbook1.sheets["DatasheetTab1"].CellsAsDouble[1,3]= 456.65;

By default, changes to Excel are not saved. To save changes, set SaveOnClose to true.

Namespace: elsystem.office.excel

Properties
  Name Type Description
Public property ActiveSheet int Gets or sets the index number of the active worksheet (default property).
Public property FileName string The path and file name of the Excel spreadsheet file on your computer.
Public property Load bool True to load and open the connection to the spreadsheet.
Public property SaveOnClose bool True to save changes made to the spreadsheet when closing the connection.
Public property Shared bool True to share a single Excel spreadsheet across multiple Workbook objects. False if not shared.
Public property SheetCount int Specifies the number of sheets in the workbook.
Public property Sheets[index] object Gets a Sheet based on an index of available sheets. One (1) based.
Public property Sheets[sSheetName] object Gets a Sheet based on a specified sheet name string.
Public property Visible bool True to display the spreadsheet when connected or False to update the spreadsheet without viewing.
Methods
  Name Description
Public property Close Closes the current instance and saves changes if SaveOnClose is set to True..
Public property Contains(Name) Returns True when string Name is the name of the active sheet in the workbook.
Public property Contains(Index) Returns True when the Index integer value matches an active sheet.
Public property Create Initializes a new instance of the class.
Public property Save Save changes to the active Excel spreadsheet file.
Public property SaveAs(string) Save changes to the specified Excel spreadsheet file.