NEW
NEW
clear the document
CellBasics exposes an ARexx port, so scripts can drive it the same way you would by hand — open and save documents, move the selection around, read and write cell values, apply formatting and more. Commands are sent to the running application's ARexx port.
Most commands act on the active document and its current selection: you typically SELECT a cell or range first, then run a command that reads or changes it. Query commands (the GET… family, VALUE, SELECTION, COLUMNS, and so on) return their answer in the ARexx RESULT variable.
A short example:
/* fill A1 and read it back */
ADDRESS 'CELLBASICS'
NEW
SELECT 'A1'
SETVALUE 'Hello'
BOLD ON
VALUE
SAY RESULT /* => Hello */
In the reference below, arguments shown in [brackets] are optional.
63 ARexx commands are available, grouped by area. Type in the box to filter by name or keyword.
NEW
clear the document
OPEN path
load a document
SAVE
save a document
SAVEAS path
save a document to path
UNDO
undo the last operation
REDO
redo the last undone operation
COPY
copy the current selection to the clipboard
CUT
cut the current selection to the clipboard
COPYVALUES
copy the current selection to the clipboard as values only (formulas discarded)
PASTE
paste the clipboard contents starting at the current selection
PASTEVALUES
paste the clipboard contents as values only (formulas discarded) starting at the current selection
SELECT cell or range
select a cell or range (A1, A1:A2, etc)
SELECTION
return current selection
VALUE
return value(s) at current selection
NUMERICALVALUE
return a number at current selection (discards formatting of dates, etc)
SETVALUE value
enter value into selected cell(s)
RUNFORMULA formula
run a given formula at currently selected cell, return the result
COLUMNS
column count (active sheet)
ROWS
row count (active sheet)
SHEET
1-based index of active sheet
SHEETS
number of sheets in document
SELECTSHEET index
select sheet at index (1-based)
INSERTROW position
1-based position to insert a new row at
INSERTCOLUMN position
1-based position to insert a new column at
DELETEROW position
delete row at 1-based position index
DELETECOLUMN position
delete column at 1-based position index
INSERTCELLSDOWN
insert cells over the current selection, shifting existing cells down within the selected columns
INSERTCELLSRIGHT
insert cells over the current selection, shifting existing cells right within the selected rows
DELETECELLSUP
delete cells in the current selection, pulling cells below up within the selected columns
DELETECELLSLEFT
delete cells in the current selection, pulling cells to the right left within the selected rows
SETFONT name
set the font of the current selection
SETFONTSIZE size
set the font size (in points) of the current selection
BOLD state
set bold on the current selection (ON/OFF, also accepts 1/0/TRUE/YES)
ITALIC state
set italic on the current selection (ON/OFF, also accepts 1/0/TRUE/YES)
UNDERLINE state
set underline on the current selection (NONE, SINGLE or DOUBLE; defaults to SINGLE)
STRIKETHROUGH state
set strikethrough on the current selection (NONE, SINGLE or DOUBLE; defaults to SINGLE)
TEXTCOLOR color
set the text color of the current selection, as a hexadecimal RRGGBB value (e.g. FF0000, optional leading #)
BGCOLOR color
set the background (fill) color of the current selection, as a hexadecimal RRGGBB value, or TRANSPARENT/NONE to clear it
ALIGN alignment
set the horizontal alignment of the current selection (LEFT, CENTER, RIGHT or JUSTIFY)
VALIGN alignment
set the vertical alignment of the current selection (TOP, CENTER or BOTTOM)
LINEWRAP state
set line wrapping on the current selection (ON/OFF, also accepts 1/0/TRUE/YES)
MERGE
merge the current selection into a single cell
UNMERGE
split any merged cells in the current selection
FRAME edges [style] [color]
set the border (frame) style of the current selection. edges selects which borders to set: ALL, OUTER, INSIDE, INSIDEH, INSIDEV, TOP, BOTTOM, LEFT, RIGHT, or NONE to clear all borders. Only the named edges are changed, the rest are left untouched. style (optional) is the line style: THIN (default), THICK, MEDIUM, HAIR, DASHED, DOTTED, DOUBLE, DASHDOT, DASHDOTDOT, MEDIUMDASHED, MEDIUMDASHDOT, MEDIUMDASHDOTDOT or SLANTDASHDOT. color (optional) is a hexadecimal RRGGBB value (defaults to black)
GETFONT
return the font name of the current selection (empty if it has multiple values)
GETFONTSIZE
return the font size of the current selection (empty if it has multiple values)
GETBOLD
return ON or OFF for the current selection (empty if it has multiple values)
GETITALIC
return ON or OFF for the current selection (empty if it has multiple values)
GETUNDERLINE
return NONE, SINGLE or DOUBLE for the current selection (empty if it has multiple values)
GETSTRIKETHROUGH
return NONE, SINGLE or DOUBLE for the current selection (empty if it has multiple values)
GETTEXTCOLOR
return the text color of the active cell as a hexadecimal RRGGBB value
GETBGCOLOR
return the background (fill) color of the active cell as a hexadecimal RRGGBB value, or TRANSPARENT
GETALIGN
return the horizontal alignment of the current selection (LEFT, CENTER, RIGHT, JUSTIFY or AUTOMATIC; empty if it has multiple values)
GETVALIGN
return the vertical alignment of the current selection (TOP, CENTER, BOTTOM or AUTOMATIC; empty if it has multiple values)
GETLINEWRAP
return ON or OFF for the current selection (empty if it has multiple values)
GETFRAME [edge]
return the border (frame) style of the active cell. With an edge argument (TOP, BOTTOM, LEFT or RIGHT) it returns that edge's style; without one it returns all four edges as "TOP:style BOTTOM:style LEFT:style RIGHT:style". See FRAME for the list of style names.
SETTYPE type
set the data type of the current selection: AUTOMATIC, WHOLENUMBER, NUMBER (or DECIMAL), TEXT, DATE, DATETIME, TIME, TIMEDELTA or CURRENCY. The appropriate default format is applied.
SETDATEFORMAT format
set a date/time format string on the current selection (e.g. YYYY-MM-DD)
CHANGEDECIMALS delta
change the number of decimal places of the current selection by delta (e.g. 1 or -1)
SETDECIMALS precision
set the number of decimal places of the current selection to precision
SETSEPARATORS state
toggle thousands separators on the current selection (ON/OFF, also accepts 1/0/TRUE/YES)
SETCURRENCY symbol
set the currency symbol of the current selection
SORT column [column ...]
sort the rows of the current selection by one or more columns, primary key first. Each column is a column letter optionally followed by a sort direction, separated by a colon: ASC/ASCENDING/A (the default) or DESC/DESCENDING/D, e.g. A, B:DESC, C:ASC. For example, SORT A C:DESC B sorts ascending by column A, then descending by C, then ascending by B. Undoable as a single operation.