Excel Commands
Excel Commands
Create Workbook
If the parent folder(s) and subfolders of the file do not exist, they are also
created. If a document with the same name already exists, it is overwritten
without additional confirmation. The File or the IF File Exists commands
may be used to check existence prior to running this command.
The new spreadsheet is not automatically opened when using the "Create
Workbook" command. Use the Open Workbook action to display and use
the spreadsheet.
The "Row Delimiter" and "Column Delimiter" determine where new rows and
columns are inside of the text. Usually, a tab or comma is used to separate
columns, and each new line of text is a new row.
A basic example:
Since the input used to create the spreadsheet is raw text, embedded
formatting options must be placed inside of the actual text:
The tags are removed prior to creating the spreadsheet. Where possible, cell formatting
options follow the standard HTML formatting names, such as "bgcolor".
bgcolor=red bgcolor=maroon
bgcolor=lime bgcolor=green
bgcolor=cyan
bgcolor=teal
bgcolor=aqua
bgcolor=blue bgcolor=navy
bgcolor=magen
ta
bgcolor=pink bgcolor=yellow
bgcolor=fuchsi
a
bgcolor=olive bgcolor=purple
bgcolor=silver bgcolor=gray
bgcolor=black bgcolor=white
color=blue
bgcolor=yellow, color=red
border=1
border=2
align=left
align=center
align=right
width=200
width=50
font=Verdana font-size=20
font=Times-New-Roman font-
size=16
font-
style=italic+bold+underlined
All of the following are valid formulas that vTask can accurately create formulas for in
Excel, when using the "Create Workbook" action:
=8+9
=8 + 9.5
=A1+B2
=$A$1 + $B$2
=A1 + B2 / A1
=A1 * B2 + 100
=A1 & B2
=A1 < B2
=A1 = B2
= A1 * B2 * C3 + 123.456
=A1 * 0.05
Excel Functions (such as SUM) and expressions with parenthesis are not
supported with the "Create Workbook" action. However, functions and
calculations can be set with the Set Excel Cell command listed below. Set
Excel Cell has no restrictions on what can be placed into a cell - even images
can be inserted.
When vTask creates a spreadsheet for you, it will intelligently format the cell
to fit the data. The default cell formatting options are used for Text, Numbers,
Money/Currency, and Dates.
Examples:
Open Workbook
This action can be used with a filename that does not exist yet. If the XLS file
does not exist, a new (blank) workbook is created. The "Save" option will
immediately save the new workbook to disk after creation.
The "Hidden" option will open the workbook, but it will not be visible to the
user. Use this option to update spreadsheets without displaying the Excel
interface. The spreadsheet will run in the background, until the Close
Workbook command is used.
To start the workbook with an initial cell or range selected, enter the
appropriate names into the "Cell or Range" field. See the Select Cell action
for a discussion of how to address specific Sheets, Cells, and Ranges.
The Close Workbook command should be used when you are finished with
all Excel actions.
Save Workbook
Close Workbook
Exits a workbook that was previously opened with the Open Workbook
command. The "Save" option will write all changes to disk. Without "Save"
chosen, the file will not be saved, and no notification will be given.
If you want to leave the spreadsheet open after the script completes, you do
not need to call the Close Workbook action. However, it is important to use
Close Workbook if you opened the spreadsheet in "Hidden" mode - otherwise
the process will continue running, invisible and inaccessible to the user.
Get Cell
Retrieves the data contents (text, number, or date) from an Excel sheet cell
or group of cells. The "Workbook Name" is required because it determines
which spreadsheet to use. This is important for situations where you are
using multiple workbooks at the same time. The name should match the
same name that was used in the Open Workbook command (an Excel .XLS
file name).
This command is able to get the contents from more than one cell, also called
a "Range" of cells. You address the range the same way that you would in
Excel itself, such as B2:C4. See the Select Cell action for a discussion of
how to address specific Sheets, Cells, and Ranges.
You can set the "Column Delimiter" to be anything you want, such as a
comma, or even a longer string. If nothing is provided, a tab character will be
used. This is the same as Excel itself provides, which can be verified by
copying a group of cells to the clipboard.
abc 100
def 200
ghi 300
Set Cell
Places new data (text, number, or date) into an Excel sheet cell or group of
cells. The "Workbook Name" is required because it determines which
spreadsheet to use. This is important for situations where you are using
multiple workbooks at the same time. The name should match the same
name that was used in the Open Workbook command (an Excel .XLS file
name).
Be sure to use the "Save" option with either Open Workbook or the Close
Workbook command to ensure that the cell changes are stored.
This command is able to set the contents from more than one cell, also called
a "Range" of cells. You address the range the same way that you would in
Excel itself, such as "B2:C4". See the Select Cell action for a discussion of
how to address specific Sheets, Cells, and Ranges.
To clear a cell (or range), use an empty value for the "Data" field (leave it
blank).
The "Save Document" option allows you to make the cell change
permanent. This option is provided in case you want to make multiple
changes before saving the document, or allowing the user to be prompted
during the save, such as when the file already exists.
Select Cell
This command places the highlight box in the location that you specify. It is a
very versatile command, and is able to perform the following:
Change to a different Sheet and activate it
Go to a Cell
Select/Highlight a Cell
Move to and select a Range of cells
For example, to put the current selection into a single cell, use an entry such
as "B2":
To put the current selection into a group of cells, use an entry such as B2:C4:
To put the current selection into a group of cells in a specific sheet, use an
entry such as Sheet2!B2:C4:
(these cell/range naming conventions are the same as Excel itself uses)
For the example table below, the following spreadsheet is used for
demonstration:
Return
Example
Format Description
(using sample
spreadsheet
above)
Returns the specified formatting for data (such as
numbers). For example, "#.00" would be numeric,
Data and "@" would be text. These are the same as the #,##0.00
Format format specifications inside of Excel, as shown in
the screen image below.
The "Custom" option shows what data formats are returned by vTask:
Changes
none, thin, medium,
Border border around thick
cell