Scripting: Interfaces and methods

Enabling scripting

To be able to use Python scripting, you need the Python package. Enabling Python scripting requires the same steps as using the Python UDF functions/formulas. Please see Installing Python and integrating it with GS-Calc.

Creating scripts

You can create your scripts either as global scripts saved in the program settings and available to all databases or you can create scripts stored in a given GS-Calc workbook and available only after you open that workbook.
To create these scripts use the "File > Application Scripts" and "File > Database Scripts" commands.

The "(...) Scripts" dialog box enables you to organize your scripts in subfolders, copy/import/export them etc.

Sample "Scripts" screen.

Notes:

GS-Calc functions available in scripts


XBaseParams

setFormat(str format) -> bool / getFormat() -> str

A string specifying the xBase file format:

Example:

	xBaseParams = gscalc.CreateXBaseParams();
	xBaseParams.setFormat("dbaseIV");
	

setEncoding(str encoding) -> bool / getEncoding() -> str

A string specifying the character encoding in the xBase file:

Example:

	xBaseParams = gscalc.CreateXBaseParams();
	xBaseParams.setEncoding("dos");
	

GetFieldCount()

Returns the number of defined database fields.

Example:

	xBaseParams = gscalc.CreateXBaseParams();
	xBaseParams.AddField("name", "C", 40, 0);
	counter = xBaseParams.GetFieldCount();
	

SetField(int index, str name, str type, int length, int decimals) -> bool

AddField(str name, str type, int length, int decimals) -> bool

InsertField(int index, str name, str type, int length, int decimals) -> bool

Update the name and type of an existing database fields.

index

One-based field index.

name

A field name consisting of up to 10 characters.

type

A string specifying any of the xBase field types:

length

The field length. The specified value is used only the "C" field (up to 65534 for FoxPro and up to 254 otherwise) and the "N"/"F" fields.
The length of other fields are fixed and can't be changed.

decimals

The number of decimal places in the "N" fields.

Example:

	xBaseParams = gscalc.CreateXBaseParams();
	xBaseParams.AddField("item", "C", 40, 0);
	xBaseParams.AddField("price", "N", 5, 2);
	xBaseParams.SetField(1, "item", "C", 50, 0);
	

GetFieldName(int index) -> str

Returns the name of a given database field.

index

A one-based index of the field.

Example:

	xBaseParams = gscalc.CreateXBaseParams();
	xBaseParams.AddField("name", "C", 40, 0);
	name = GetFieldName(1); # returns "name"
	

GetFieldType(int index) -> str

Returns the type of a given database field.

index

A one-based index of the field.

Example:

	xBaseParams = gscalc.CreateXBaseParams();
	xBaseParams.AddField("name", "C", 40, 0);
	name = GetFieldType(1); # returns "C"
	

GetFieldLength(int index) -> int

Returns the length of a given database field.

index

A one-based index of the field.

Example:

	xBaseParams = gscalc.CreateXBaseParams();
	xBaseParams.AddField("name", "C", 40, 0);
	name = GetFieldLength(1); # returns 40
	

GetFieldDecimals(int index) -> int

Returns the length of a given numeric ("N") database field.

index

A one-based index of the field.

Example:

	xBaseParams = gscalc.CreateXBaseParams();
	xBaseParams.AddField("name", "C", 40, 0);
	name = GetFieldLength(1); # returns 40
	

DeleteField(int index) -> bool

Deletes a given database field.

index

A one-based index of the field.

Example:

	xBaseParams = gscalc.CreateXBaseParams();
	xBaseParams.AddField("first_name", "C", 40, 0);
	xBaseParams.AddField("last_name", "C", 40, 0);
	xBaseParams.AddField("street", "C", 40, 0);
	xBaseParams.AddField("city", "C", 40, 0);
	name = DeleteField(3);
	

TextParams

setSeparator(str separator) -> None / getSeparator() -> str

Specifies a character separatoring columns in a text file.

Example:

	textParams1 = gacalc.CreateTextParams();
	textParams1.setSeparator("\t"); # tab-separeted values
	textParams2 = gscalc.CreateTextParams();
	textParams2.setSeparator(","); # command-separated values
	

setEncoding(srt encoding) -> bool / getEncoding() -> str

A string specifying the character encoding in the text file:

Example:

	textParams = gscalc.CreateTextParams();
	textParams.setEncoding("utf8");
	

setQuotingSymbol(str symbol) -> None / getQuotingSymbol() -> str

Specifies a character used to quote values containing column/value separators. The inner quoting symbols are doubled.

Example:

	textParams = gscalc.CreateTextParams();
	textParams.setQuotingSymbol("\"");
	

setLoadNumbers(bool value) -> None / getLoadNumbers() -> bool

A logical value specifying whether strings representing unformatted numbers should be converted to numbers. If the value is set to false, a text file will be open/saved faster and all worksheet cells will be text cells.

Example:

	textParams = gscalc.CreateTextParams();
	textParams.setLoadNumbers(True);
	

setLoadNumbers(bool value) -> None / getLoadFmtNumbers() -> bool

A logical value specifying whether strings representing formatted numbers should be converted to numbers. If the value is set to false, a text file will be open/saved faster and formatted numbers will become text cells.

Example:

	textParams = gscalc.CreateTextParams();
	textParams.setLoadFmtNumbers(True);
	

setLoadDates(bool value) -> None / getLoadDates() -> bool

A logical value specifying whether strings representing date/time values should be converted to date serial numbers. If the value is set to false, a text file will be open/saved faster and date strings will become text cells.
If the date data is to be sorted correctly, it must be converted to date serial numbers.

Example:

	textParams = gscalc.CreateTextParams();
	textParams.setLoadDates(False);
	

setLoadDateStyles(bool value) -> None / getLoadDateStyles() -> bool

A logical value specifying whether styles of the date/time values converted to date serial numbers should be preserved in the opened worksheet. If the value is set to false, cells containing date serial numbers will be displaying them as numbers.

Example:

	textParams = gscalc.CreateTextParams();
	textParams.setLoadDateStyless(False);
	

setParsingMode(int parsing) -> bool / getParsingMode() -> int

A value specifying if and how possible formulas should be parsed when opening a text file:

Example:

	textParams = gscalc.CreateTextParams();
	textParams.setParsingMode(3);
	

setColumnWidths(str columnWidths) -> bool / getColumnWidths() -> str

A string specifying fixed column/value widths in the text file. Setting this value overwrites previously defined column/value separator. If a text file line contains more characters than the specified widths, the remaining ones will be forming subsequent max-1024-character fields.

Example:

	textParams = gscalc.CreateTextParams();
	textParams.setColumnWidths("10, 30, 15, 20");
	

setSaveFmtNumbers(bool value) -> None / getSaveFmtNumbers() -> bool

A logical value specifying whether numbers from formatted cells shoud be saved as formatted numbers or as as generic non-formatted numbers (e.g. 1,123.10 vs 1123.1).

Example:

	textParams = gscalc.CreateTextParams();
	textParams.setSaveFmtNumbers(False);
	

setSaveFmtNumbers(bool value) -> None / getSaveFmtDates() -> bool

A logical value specifying whether formatted dates (serial numbers and generic date/time strings) should be saved as the resulting formatted strings.

Example:

	textParams = gscalc.CreateTextParams();
	textParams.setSaveFmtDates(True);
	

setSaveFormulaValues(bool value) -> None" / getSaveFormulaValues() -> bool

A logical value specifying whether formulas values should be saved in a text file. If it's set to "false", the very formulas will be saved instead.

Example:

	textParams = gscalc.CreateTextParams();
	textParams.setSaveFormulaValues(False);
	

setAutoFitColumns(bool value) -> Nones / getAutoFitColumns() -> bool

A logical value specifying whether after opening a given file columns should be automatically resized to fit their contents. Note: specifying 1/True will result in additional calculations after opening that file which may the entire opening process slightly longer.

Example:

	textParams = gscalc.CreateTextParams();
	textParams.setAutoFitCols(False);
	

MergeParams

A set of parameters used by rows-merging functions.


FormatParams

setDataStyleName(str name) -> bool / getDataStyleName() -> str

A string specifying the predefined data style name:

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setDataStyleName("Currency");
	

SetGeneralNumberFormat(str decimals, BYTE zeroes, bool brackets, bool inRed, bool separators, int scaling) -> bool

In addition to setting the value of the dataStyleName property, this function enables you to modify the default options for the selected data style. decimals
The number of decimal places. This can be "auto" or any number from 0 to 14.
Default value: "auto"
zeroes
The number of leading zeroes. This can be any number from 0 to 14.
Default value: 1
brackets
A logical value specifying whether negative numbers should be enclosed in brackets.
Default value: False
inRed
A logical value specifying whether negative numbers should be displayed in red.
Default value: False
separators
A logical value specifying whether thousand separators should be used.
Default value: False
scaling
The display factor as a power of 1000. This can be any number from 0 to 5.
Default value: 0

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.SetGeneralNumberFormat(4, 1, False, False, False, 0);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

SetCurrencyFormat(str decimals, str position, str symbol, bool brackets, bool inRed, int scaling) -> bool

In addition to setting the value of the dataStyleName property, this function enables you to modify the default options for the selected data style. decimals
The number of decimal places. This can be "auto" or any number from 0 to 14.
Default value: "auto" (=2)
position
A string specifying the position of the currency symbol:

Default value: "$1.1"
symbol
A string specifying the currency symbol.
Default value: "$"
brackets
A logical value specifying whether negative numbers should be enclosed in brackets.
Default value: False
inRed
A logical value specifying whether negative numbers should be displayed in red.
Default value: False
scaling
The display factor as a power of 1000. This can be any number from 0 to 5.
Default value: 0

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.SetCurrencyFormat(0, "$1.1", "$", False, False, 0);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

SetAccountingFormat(str decimals, str symbol, int scaling) -> bool

In addition to setting the value of the dataStyleName property, this function enables you to modify the default options for the selected data style. decimals
The number of decimal places. This can be "auto" or any number from 0 to 14.
Default value: "auto" (=2)
symbol
A string specifying the currency symbol.
Default value: "$"
scaling
The display factor as a power of 1000. This can be any number from 0 to 5.
Default value: 0

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.SetAccountingFormat(0, "$", 0);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

SetDateFormat(str pattern, bool systemOrder) -> bool

In addition to setting the value of the dataStyleName property, this function enables you to modify the default options for the selected data style. pattern
A string specifying the date format:
"m/d/yyyy", "mm/dd/yyyy", "m/d/yy", "mm/dd/yy", "m/d", "mm/yy", "mmm-d", "mmm-d-yyyy", "mmm-d-yy" "mmmm d, yyyy", "dddd, mmmm dd, yyyy".
Default value: "m/d/yyyy"
systemOrder
A logical value specifying whether day-month display order should be determined by the current system settings.
Default value: True

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.SetDateFormat("m/d", True);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

SetTimeFormat(str pattern) -> bool

In addition to setting the value of the dataStyleName property, this function enables you to modify the default options for the selected data style. pattern
A string specifying the date format:
"h:mm", "h:mm AM/PM", "hh:mm", "hh:mm AM/PM", "h:mm:ss", "h:mm:ss AM/PM", "hh:mm:ss", "hh:mm:ss AM/PM", "[m]:ss.00", "[h]:mm:ss", "[d] hh:mm"
Default value: "h:mm"

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.SetTimeFormat("hh:mm AM/PM");
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

SetDateTimeFormat(str datePattern, str timePattern, bool systemOrder, bool timeFirst) -> bool

In addition to setting the value of the dataStyleName property, this function enables you to modify the default options for the selected data style. The meaning of first three arguments is the same as in SetDateFormat and SetTimeFormat methods listed above.
timeFirst
A logical value specifying whether the time string should precede the date string.
Default value: False

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.SetDateTimeFormat("m/d","hh:mm AM/PM", True, False);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

SetPercentFormat(str decimals, int scaling) -> bool

In addition to setting the value of the dataStyleName property, this function enables you to modify the default options for the selected data style. decimals
The number of decimal places. This can be "auto" or any number from 0 to 14.
Default value: "auto"
scaling
The display factor as a power of 1000. This can be any number from 0 to 5.
Default value: 0

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.SetPercentFormat(0, 0);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

SetFractionFormat(long denominator, bool digits) -> bool

In addition to setting the value of the dataStyleName property, this function enables you to modify the default options for the selected data style. denominator
If digits is True, this argument specifies the fixed number of denominator digits.
If digits is False, this argument specifies the fixed denominator value.
Default value: digits: False, denominator: 1

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.SetFractionFormat(2, False);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

SetScientificFormat(str decimals, const str exponent) -> bool

In addition to setting the value of the dataStyleName property, this function enables you to modify the default options for the selected data style. decimals
The number of decimal places. This can be "auto" or any number between 0 and 14.
Default value: "auto"
exponent
The value of the exponent. This can be "auto" or any number between -99 and 99.
Default value: "auto"

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.SetScientificFormat("auto", 12);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setFontName(str name) -> bool / getFontName() -> str

A string specifying the font name. To specify the default font name, use an empty string.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setFontName("Tahoma");
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setFontSize(int size) -> bool / getFontSize() -> int

The size of the font in points. To specify the default size, use zero.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setFontSize(8);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setLanguage(str language) -> bool / getLanguage() -> str

A string specifying the language related to the font. This is a standard language code typically consisting of the country-language pair, eg: en-US, en-GB, en-AU, de-DE, de-AU, es-ES, pl-PL, ru-RU etc.
If the submitted string is invalid, it'll default to en-US.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setLanguage("en-GB");
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setBoldFont(bool bold) -> bool / getBoldFont() -> bool

Toggles the "bold" font attribute on/off.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setBoldFont(True);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setItalicFont(bool italic) -> bool / getItalicFont() -> bool

Toggles the "italic" font attribute on/off.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setItalicFont(True);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setUnderlineFont(bool uline) -> bool / getUnderlineFont() -> bool

Toggles the "underline" font attribute on/off.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setUnderlineFont(True);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setStrikeoutFont(bool sline) -> bool / getStrikeoutFont() -> bool

Toggles the "strikeout" font attribute on/off.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setStrikeoutFont(True);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setFontColor(str color) -> bool / getFontColor() -> str

Specifies the font color. Accepted values are: the default system "auto" color, predefined color names and strings representing 3-byte RGB color values using the hex notation.
The predefined values include: "black", "maroon", "green", "olive", "navy", "purple", "teal", "gray", "silver", "red", "lime", "yellow", "blue", "fuchsia", "aqua", "white".

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setFontColor("#FF0000");
	formatParams.setFontColor("green");
	formatParams.setFontColor("auto");
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setHorzAlignment(str horzAlign) -> bool / getHorzAlignment() -> str

Specifies the horizontal text alignment in cells. Accepted values are the following strings:

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setHorzAlignment("center");
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setVertAlignment(str vertAlign) -> bool / getVertAlignment() -> str

Specifies the vertical text alignment in cells. Accepted values are the following strings:

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setVertAlignment("center");
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setHorzIndent(int indent) -> bool / getHorzIndent() -> int

Specifies the horizontal text indent in cells. Accepted values are between 0 and 255. The default value is 4.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setHorzIndent(4);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setVertIndent(int indent) -> bool / getVertIndent() -> int

Specifies the vertical text indent in cells. Accepted values are between 0 and 255. The default value is 2.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setVertIndent(1);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setWrapText(bool value) -> bool / getWrapText() -> bool

A logical value that toggles wrapping text in cells on/off. Setting this property to True automatically sets the shrinkText property to False.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setWrapText(True);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setShrinkText(bool value) -> bool / getShrinkText() -> bool

A logical value that toggles shrinking text that overflows the width of the cells on/off. Setting this property to True automatically sets the wrapText property to False.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setShrinkText(True);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setTextRotation(int rotation) -> bool / getTextRotation() -> int

Specifies the rotation of the text in cells. Acceptable values are from -90 to 90 degrees.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setTextRotation(25);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setHideFormula(bool value) -> bool / getHideFormula() -> bool

A logical value that toggles hiding formulas on/off.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setHideFormula(True);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setProtectedCell(bool value) -> bool / getProtectedCell() -> bool

A logical value that toggles cell protection on/off.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setProtectedCell(True);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setPrintedCell(bool value) -> bool / getPrintedCell() -> bool

A logical value that toggles printing cell contents on/off.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setPrintedCell(True);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setBorderStyle(str style) -> bool / getBorderStyle() -> str

Specifies the cell border style. The following style names are accepted:

Specifying "none" remove all borders around the cell.

Example:

wbook = gscalc.ActiveWorkbook(); wsheet = wbook.GetActiveWorksheet(); formatParams = wsheet.CreateFormatParams(); formatParams.setBorderColor("green"); formatParams.setBorderPosition(15); formatParams.setBorderStyle("solid"); formatParams.setBorderWidth(1); formatParams.setBorderDoubleLine(True); wsheet.setSelectedRange("d4"); wsheet.SetCellFormat(formatParams);

setBorderWidth(int width) -> bool / getBorderWidth() -> int

Specifies the cell border width. Accepted values are from 1 to 16 logical pixels.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setBorderColor("green");
	formatParams.setBorderPosition(15);
	formatParams.setBorderStyle("solid");
	formatParams.setBorderWidth(1);
	formatParams.setBorderDoubleLine(True);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setBorderDoubleLine(bool doubleLine) -> bool / getBorderDoubleLine() -> bool

A logical value that toggles displaying double borders.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setBorderColor("green");
	formatParams.setBorderPosition(15);
	formatParams.setBorderStyle("solid");
	formatParams.setBorderWidth(1);
	formatParams.setBorderDoubleLine(True);
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setBorderColor(str color) -> bool / getBorderColor() -> st

Specifies the cell border color. Accepted values are: the default system "auto" color, predefined color names and strings representing 3-byte RGB color values using the hex notation.
The predefined values include: "black", "maroon", "green", "olive", "navy", "purple", "teal", "gray", "silver", "red", "lime", "yellow", "blue", "fuchsia", "aqua", "white".

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setBorderColor("green");
	formatParams.setBorderPosition(15);
	formatParams.setBorderStyle("solid");
	formatParams.setBorderWidth(1);
	formatParams.setBorderDoubleLine(True);
	wsheet.setBelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setBorderPosition(int pos) -> bool / getBorderPosition() -> int

Specifies the cell border color. The following numeric values and their combinations are accepted:

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setBorderColor("green");
	formatParams.setBorderPosition(15);
	formatParams.setBorderStyle("solid");
	formatParams.setBorderWidth(1);
	formatParams.setBorderDoubleLine(True);
	wsheet.setBelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setBkgColor(str color) -> bool / getBkgColor() -> str

Specifies the cell background color. Accepted values are: the default system "auto" color, predefined color names and strings representing 3-byte RGB color values using the hex notation.
The predefined values include: "black", "maroon", "green", "olive", "navy", "purple", "teal", "gray", "silver", "red", "lime", "yellow", "blue", "fuchsia", "aqua", "white".

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setBkgColor("#FF0000");
	formatParams.setBkgColor("green");
	formatParams.setBkgColor("auto");
	wsheet.setBelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setBkgImageName(str name) -> bool / getBkgImageName() -> str

Specifies the cell background image. The name must represent an image available via the workbook list of images (see: "Cell Format > Background > Images").

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setBkgImageName("blue-sphere.png");
	formatParams.setBkgImageOpacity(100);
	formatParams.setBkgImageHorzPos("left");
	formatParams.setBkgImageVertPos("center");
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setBkgImageRepeat(str repeat) -> bool / getBkgImageRepeat() -> strt

Specifies how the cell background image should be displayed within the cell. The following text strings values are accepted:

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setBkgImageName("blue-sphere.png");
	formatParams.setBkgImageRepeat("repeat");
	formatParams.setBkgImageOpacity(100);
	formatParams.setBkgImageHorzPos("left");
	formatParams.setBkgImageVertPos("center");
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setBkgImageHorzPos(str horzPos) -> bool / getBkgImageHorzPos() -> str

Specifies the horizontal position of the cell background image. The following text string values are accepted:

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setBkgImageName("blue-sphere.png");
	formatParams.setBkgImageHorzPos("right");
	formatParams.setBkgImageOpacity(100);
	formatParams.setBkgImageHorzPos("left");
	formatParams.setBkgImageVertPos("center");
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setBkgImageVertPos(str vertPos) -> bool / getBkgImageVertPos() -> str

Specifies the vertical position of the cell background image. The following text string values are accepted:

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setBkgImageName("blue-sphere.png");
	formatParams.setBkgImageVertPos("top");
	formatParams.setBkgImageOpacity(100);
	formatParams.setBkgImageHorzPos("left");
	formatParams.setBkgImageVertPos("center");
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

setBkgImageOpacity(int opacity) -> bool / getBkgImageOpacity() -> int

Specifies the cell background image opacity. This is numeric value between 0 (a fully transparent image) to 100 (a fully opaque image).

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setBkgImageName("blue-sphere.png");
	formatParams.setBkgImageVertPos("top");
	formatParams.setBkgImageOpacity(70);
	formatParams.setBkgImageHorzPos("right");
	formatParams.setBkgImageVertPos("center");
	wsheet.setSelectedRange("d4");
	wsheet.SetCellFormat(formatParams);
	

Reset() -> None

Resets the FormatParams object and initiates it with default or empty attributes.
When using such an object with the formatting method of the Worksheet object, only submitting explicitly a given FormatParams property triggers a corresponding formatting action. For example, the following code:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setBoldFont(True);
	formatParams.setItalicFont(True);
	wsheet.setSelectedRange("b10:b20");
	wsheet.SetCellFormat(formatParams);
	

is an equivalent to clicking the "Bold" toolbar button, then the "Italic" format button. If the following code re-use the same FormatParams object without resetting:

	formatParams.setDataStyleName("Currency");
	wsheet.setSelectedRange("b10:b20");
	wsheet.SetCellFormat(formatParams);
	

it will be an equivalent to clicking the "Bold" toolbar button, then the "Italic" format button, then choosing the "Currency" style.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.Reset();
	


Worksheet

setSelectedRange(str range) -> None / getSelectedRange() -> str

Specifies the current cell range selection.

After selecting a new range, the corresponding active worksheet will be scrolled to ensure that range (or at least its top-left cell) is visible.
Setting a selection automatically de-select any currently selected objects.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.setSelectedRange("c20");
	wsheet.UpdateWindows();
	gscalc.Sleep(2000);
	wsheet.setSelectedRange("c20:d22");
	wsheet.UpdateWindows();
	gscalc.Sleep(2000);
	wsheet.setSelectedRange("2:2");
	wsheet.UpdateWindows();
	gscalc.Sleep(2000);
	wsheet.setSelectedRange("H:I");
	

setTopLeftCell(str range) -> None / getTopLeftCell() -> str

Specifies the top-left cell of the worksheet window.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.setTopLeftCell("c20");
	

Scroll(str type, bool scrollSelection) -> None

Scrolls the worksheet view. If scrollSelection is False, calling this method corresponds to dragging the scroll boxes of the view scrollbars (and to pressing scrolling keys with the "Scroll Lock" key on.
If scrollSelection is False (and the "Scroll Lock" key off), calling this method corresponds to pressing the cursor keys.
Unlike other methods, Scroll enforces screen updates during the excecution of the script so UpdateWindow() doesn't have to be used.

The type argument can be of the following text strings:

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	for i in range(0, 50) :
		wsheet.Scroll("line-down", True);
		gscalc.Sleep(200);
	

Address(int column, bool relativeColumn, int row, bool relativeRow) -> str

Creates and returns and a string representing the specified relative or absolute cell address, depending on the logical relativeColumn and relativeRow arguments.
To obtain only the column or row name/number, specify 0 as the 2nd argument.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	cell = wsheet.Address(3, True, 20, Talse); # returns "C$20"
	cell = wsheet.Address(3, Talse, 0, Talse); # returns "$C"
	

RC(str range) -> int left, int top, int right, int bottom

Returns four integers representing the top-left and bottom-right coordinates of the specified cell or rangethe column or row name/number, specify 0 as the 2nd argument. The numbers are returned in the following order: the left column, the top row, the right column, the bottom row

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	cell = wsheet.RC("b10") # returns 2, 10, 2, 10
	cell = wsheet.RC("b10:c20"); # returns 2, 10, 3, 20
	

Column(str cell) -> int

Returns the column number of the specified cell address.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	column = wsheet.Column("C20"); # returns 3
	

Row(str cell) -> int

Returns the column number of the specified cell address.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	column = wsheet.Column("C20"); # returns 20
	

GetFirstColumn() -> int

Returns the number of the first non empty column.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	column = wsheet.GetFirstColumn();
	

GetFirstRow() -> int

Returns the number of the first non empty row.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	row = wsheet.GetFirstRow();
	

GetLastColumn() -> int

Returns the number of the last non empty column.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	column = wsheet.GetLastColumn();
	

GetLastRow() -> int

Returns the number of the last non empty row.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	row = wsheet.GetLastRow();
	

GetMaxColumn() -> int

Returns the maximum column number.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	column = wsheet.GetMaxColumn();
	

GetMaxRow() -> int

Returns the maximum row number.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	row = wsheet.GetMaxRow();
	

CreateFormattingParams() -> FormatParams

Creates and returns an object containing cell formatting parameters. The FormatParams object is then used to retrieve existing cell formats and to set new ones.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setBoldFont(True);
	formatParams.setItalicFont(True);
	wsheet.setSelectedRange("b1:b20");
	wsheet.SetCellFormat(formatParams);
	

GetCellFormat(FormatParams params) -> None

Retrieves a cell format for the selected cell or range. The corresponding column or row format is ignored and must be obtained using the GetColumnFormat() and GetRowFormat() methods.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	wsheet.setSelectedRange("b10:b20");
	wsheet.GetCellFormat(formatParams);
	

GetColumnFormat(FormatParams params) -> None

Retrieves a column format relative to the seleted cell or range.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	wsheet.setSelectedRange("b10:b20");
	wsheet.GetColumnFormat("b10:b20", formatParams);
	

GetRowFormat(FormatParams params) -> None

Retrieves a row format relative to the selected cell or range.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	wsheet.setSelectedRange("b10:b20");
	wsheet.GetRowFormat(formatParams);
	

SetCellFormat(FormatParams params) -> bool

Formats the selected cell or range of cells using formatting attributes set in the FormatParams object. If the range doesn't include any complete columns or rows, the formatting will be applied to subsequent individual cells.
If the selected range specifies a column selection (e.g. c1:c12582912, h1:12582912, c:c, c:h), the formatting will be applied to whole columns.
If the selected range specifies a row selection (e.g. a10:fan10, 1:1, 4:6), the formatting will be applied to whole rows.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	formatParams = wsheet.CreateFormatParams();
	formatParams.setBoldFont(True);
	formatParams.setItalicFont(True);
	wsheet.setSelectedRange("b10:b20");
	wsheet.SetCellFormat(formatParams);
	

SetCellCustomStyle(str name) -> bool

Formats the selected cell or a range of cells using a user-defined custom cell style/format. Cell styles can be added, edited and deleted via the "Format > Custom Cell Styles" dialog box or via the "Format > Cell Format" dialog box.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.setSelectedRange("b10:b20");
	wsheet.SetCellCustomStyle("cell style 1.");
	

DeleteCells(bool dialogBox, str contentType) -> bool

Deletes selected cell(s). The showDialogBox argument is a logical value that specifies whether the Delete dialog box should be displayed.
The contentType argument is a text string specifying the type of the deleted data. It can be any combination of the

The data option is an equivalent to "number, labels, formulas".

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.setSelectedRange("c10:c20");
	wsheet.DeleteCells(False, "data");
	wsheet.setSelectedRange("d10");
	wsheet.DeleteCells(False, "formatting");
	wsheet.setSelectedRange("b4");
	wsheet.DeleteCells(True, "formatting, lists, comments");
	

CopyCells(int copyType) -> bool

Copies selected cell(s).The contentType argument is a numeric 0-7 value specifying the type of the copy action:

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.setSelectedRange("c10:c20");
	wsheet.CopyCells(0);
	wsheet.setSelectedRange("d10");
	wsheet.PasteCells(True);
	wsheet.setSelectedRange("b4");
	wsheet.CopyCells(0);
	wsheet.setSelectedRange("b5");
	wsheet.PasteCells(True);
	wbook.WaitForUpdate(); # to allow the background updating to complete before further actions
	# ...
	

PasteCells(bool textAndFormatting) -> bool

Pastes previously copied cell(s) or the textual data from the Clipboard. The textAndFormatting argument is a logical value specifying whether the copied cells should be pasted along with their formatting.
If the current selection is a single cell, the copied and pasted data block will be the same. If the current selection spans multiple rows and/or columns, the pasted data will be duplicated, filling the selected range if it's bigger than the source range.

Executing a large number of the PasteCells actions will be faster if the updateMode property is set to manual and the application/workbook window is minimized.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.setSelectedRange("c10:c20");
	wsheet.CopyCells(0);
	wsheet.setSelectedRange("d10");
	wsheet.PasteCells(True);
	wsheet.setSelectedRange("b4");
	wsheet.CopyCells(0);
	wsheet.setSelectedRange("b5:b10");
	wsheet.PasteCells(True);
	

GetColumnWidth() -> str

Returns width of the current column (a column related to the top-left cell of the selection) in pixels. The width is calculated for the view scale = 100%. If the column width is automatic, the "auto" string is returned.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	width = wsheet.GetColumnWidth();
	

SetColumnWidth(str width) -> bool

Sets the width for the columns included in the currently selected range. The width argument is a text string that can represent either a width in pixels related to the view scale = 100% or the "auto" text string. The latter causes adjusting the widths to the contained data.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.setSelectedRange("b5:e5");
	wsheet.SetColumnWidth("auto");
	wsheet.setSelectedRange("f5");
	wsheet.SetColumnWidth("30");
	

GetRowHeight() -> str

Returns the height of the current row (a row related to the top-left cell of the selection) in pixels. The height is calculated for the view scale = 100%. If the row height is automatic, the "auto" string is returned.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	height = wsheet.GetRowHeigh();
	

SetRowHeight(str height) -> bool

Sets the height for the rows included in the currently selected range. The height argument is a text string that can represent either a width in pixels related to the view scale = 100% or the "auto" text string. The latter turns on automatic heights (that is, heights adjusted to the contained data).

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.setSelectedRange("b5:e5");
	wsheet.SetRowHeight("auto");
	wsheet.setSelectedRange("f5");
	wsheet.SetRowHeight("30");
	

InsertColumns(int type) -> bool

Inserts new columns based on the currently selected range. The argument is a numeric value that specifies the following:

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.setSelectedRange("b5:e5");
	wsheet.InsertColumns(1);
	wsheet.setSelectedRang("f5");
	wsheet.InsertColumns(3);
	wbook.WaitForUpdate(); # to allow the background updating to complete before further actions
	# ...
	

DeleteColumns() -> bool

Deletes columns based on the currently selected range.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.setSelectedRange("b5:e5");
	wsheet.DeleteColumns();
	wsheet.setSelectedRange("f5");
	wsheet.DeleteColumns();
	

InsertRows(int type) -> bool

Inserts new rows based on the currently selected range. The argument is a numeric value that specifies the following:

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.setSelectedRange("b5:b10");
	wsheet.InsertRows(1);
	wsheet.setSelectedRange("b11");
	wsheet.InsertRows(3);
	wbook.WaitForUpdate(); # to allow the background updating to complete before further actions
	# ...
	

DeleteRows() -> bool

Deletes rows based on the currently selected range.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.setSelectedRange("b5:b10");
	wsheet.DeleteRows(1);
	wsheet.setSelectedRange("b11");
	wsheet.DeleteRows(3);
	

InsertSeries() -> bool

Insert a new data series based on the currently selected range. For the detailed description of this function, please see the "Entering data > Inserting series" help topic.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.setSelectedRange("b5:b100");
	wsheet.InsertSeries();
	wbook.WaitForUpdate(); # to allow the background updating to complete before further actions
	# ...
	

IsText(str cell-or-range) -> bool / IsTextRC(int row, int column) -> bool

Returns True is the specified cell contains a text/label.
If cell is a cell range, the method returns True if that range contains at least one text string and zero or more empty cells.
Otherwise the False value is returned.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	check1 = wsheet.IsText("b5:b100");
	check2 = wsheet.IsText("b101");
	

IsNumber(str cell-or-range) -> bool / IsNumberRC(int row, int column) -> bool

Returns True is the specified cell contains a numbers.
If cell is a cell range, the method returns True if that range contains at least one number and zero or more empty cells.
Otherwise the False value is returned.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	check1 = wsheet.IsNumber("b5:b100");
	check2 = wsheet.IsNumber("b101");
	

IsFormula(str cell-or-range) -> bool / IsFormulaRC(int row, int column) -> bool

Returns True is the specified cell contains a formula.
If cell is a cell range, the method returns True if that range contains at least one formula and zero or more empty cells.
Otherwise the False value is returned.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	check1 = wsheet.IsFormula("b5:b100");
	check2 = wsheet.IsFormula("b101");
	

IsFormulaNumericRC(int row, int column) -> bool

IsFormulaTextualRC(int row, int column) -> bool

IsError(str cell-or-range) -> int / IsErrorRC(int row, int column) -> int

Returns the first found error code for the specified cell or range or 0 if the cell or range doesn't contain any cells/formulas returning errors. The possible error codes are as follows:

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	check1 = wsheet.IsError("b5:b100");
	check2 = wsheet.IsError("b101");
	

InsertData(str cell-or-range, str data, bool parse) -> bool

Inserts data into the specified cell or range. The data argument can be any text string containing up to 1024 characters. The parse argument is a logical value that specifies whether the submitted data should be parsed automatically and inserted as a number, date, a text string or a formula. If it's set to False, the entered data will be always treated as text - same as pressing Enter vs Enter+Shift when entering cell contents.
This function fully simulates manual data entering.

When entering large data sets, it's typically much more faster to use the Copy/Paste and InsertSeries methods and their variants.
Using InsertData() method will be also much faster if the updateMode property is set to manual and the application/workbook window is minimized as show in the 2nd example below.

Example 1.:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.InsertData("b5", "11.5", True);
	wsheet.InsertData("b6", "1.7", True);
	wsheet.InsertData("b7:b10", "-0.1", True);
	wsheet.InsertData("b11", "=sum(b5:b10)", True);
	wbook.WaitForUpdate(); # to allow the background updating to complete before further actions
	# ...
	

Example 2.:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	gscalc.MinimizeAppWindow();
	updateMode = wbook.getUpdateMode();
	wbook.setUpdateMode("manual");

	for i in range(1, 200000) :
		ref = "b" + i;
		wsheet.InsertData(ref, "some text data", False);
	wbook.setUpdateMode(updateMode);
	gscalc.RestoreAppWindow();
	

InsertNumber(str cell, float value) -> bool / InsertNumberRC(int row, int colum, float value) -> bool

InsertText(str cell, str text) -> bool / InsertTextRC(int row, int colum, str text) -> bool

InsertFormula(str cell, str formula) -> bool / InsertFormulaRC(int row, int colum, str formula) -> bool

InsertComments(str cell, str comments) -> bool / InsertCommentsRC(int row, int colum, str comments) -> bool

Adds comments to specified cell. The comments argument can be any text string containing up to 1024 characters.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.InsertComments("b5", "comments in b5");
	wsheet.InsertComments("b6", "comments in b6");
	

InsertMatrix(str topLeftCell, matrix) -> bool

GetData(str cell, bool formatted) -> str

Returns data from the specified cell. The returned data can represent:

If formatted=True, the returned string will include the corresponding formatting.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.InsertData("b5", "11.5", True);
	wsheet.InsertData("b6", "1.7", True);
	wsheet.InsertData("b7:b10", "-0.1", True);
	wsheet.InsertData("b11", "=sum(b5:b10)", True);
	sum = wsheet.GetData("b5:b10"); # sum = 12.8
	

GetNumber(str cell) -> float / GetNumberRC(int row, int column) -> float

GetText(str cell) -> str / GetTextRC(int row, int column) -> str

GetFormula(str cell) -> str / GetFormulaRC(int row, int column) -> str

Returns formula from the specified cell that contains some formula.
If the specify cell doesn't contain a formula, an empty string is returned.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.InsertData("b5", "11.5", True);
	wsheet.InsertData("b6", "1.7", True);
	wsheet.InsertData("b7:b10", "-0.1", True);
	wsheet.InsertData("b11", "=sum(b5:b10)", True);
	formula = wsheet.GetFormula("b11"); # formula = "sum(b5:b10)"
	

GetComments(str cell) -> str / GetCommentsRC(int row, int column) -> str

Returns comments for the specified cell. If the cell doesn't have comments, an empty string is returned.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.InsertComments("b5", "comments in b5");
	comments = wsheet.GetComments("b5"); # comments = "comments in b5"
	

GetMatrix64F(str range) -> matrix (float64)

GetMatrix32F(str range) -> matrix (float32)

GetMatrix64I(str range) -> matrix (int64)

GetMatrix64U(str range) -> matrix (uint64)

GetMatrix32I(str range) -> matrix (int32)

GetMatrix32U(str range) -> matrix (uint32)

GetMatrix8I(str range) -> matrix (int8)

GetMatrix8U(str range) -> matrix (uint8)

GetSparseMatrix(str range, int type) -> array (uint32), array (uint32), array (float64)

InsertSparseMatrix(str topLeftCell, rows (array), columns (array), values (array)) -> bool

TerminateUpdateThreads() -> None

UpdateWindow()

UpdateWindow enforces GS-Calc to perform any pending screen updates of the workbook window before the script terminates and passes the control back to it.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.setTopLeftCell("cv100"0;
	wsheet.UpdateWindow();
	gscalc.Sleep(3000);
	wsheet.setSelectedRange("ab10");
	wsheet.UpdateWindow();
	

SaveSelectionAsImage(str filePath) -> bool

Saves the currently selected chart or image (if an object is selected) or the current cell range (if no object is selected) as an image to the specified file. The image format is determined by the file extension: *.png, *.jpg, *.gif, *.bmp, *.tiff.
If the file argument is an empty string, the standard Save File dialog box is displayed.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.setSelectedRange("b5:b10");
	wsheet.SaveSelectionAsImage("d:\\image1.png");
	

Print(bool dialogBox, str range, str pageList) -> bool

Prints the active worksheet. The "rangeType" string can be one of the following:

"All" is the default value. If the "pages" type is specified, the pageList should be a string consisting of comma-separated page numbers.

Example:

	wbook = gscalc.ActiveWorkbook();
	wsheet = wbook.GetActiveWorksheet();
	wsheet.Print(False, "pages", "2,3,6-7");
	

Workbook

ActiveWorksheet() -> Sheet

Returns the active worksheet object. All methods called on this object always refers to the currently selected worksheet.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.SelectTreeItem("sheet1");
	wsheet = wbook.GetActiveWorksheet();
	wsheet.InsertData("b5", "data entered in sheet1!b5", True);
	wbook.SelectTreeItem("sheet2");
	wsheet.InsertData("b5", "data entered in sheet2!b5", True);
	

SetActiveWorksheet(str path) -> bool

SetActiveFolder(str path) -> bool

GetActiveFolderPath() -> str

GetActiveWorksheetPath() -> str

GetWorksheetCount() -> int

Returns the number of worksheets in the workbook.

Example:

	wbook = gscalc.ActiveWorkbook();
	counter = wbook.GetWorksheetCount();
	

GetFolderCount() -> int

Returns the number of folders in the workbook.

Example:

	wbook = gscalc.ActiveWorkbook();
	counter = wbook.GetFolderCount();
	

IsFolderEmpty(str folder) -> int

Returns True if the specified folder doesn't contain any tree items (worksheets or folders) and False otherwise.

Example:

	wbook = gscalc.ActiveWorkbook();
	empty = wbook.IsFolderEmpty("folder1");
	

GetFirstTreeItem(str folder) -> str

Returns the first tree item (worksheets or folders) of the specified folder. If the folder argument is an empty string, the first item of the entire worksheet tree is returned. The returned value has a form of the full tree tree path.

Example:

	wbook = gscalc.ActiveWorkbook();
	item1 = wbook.GetFirstTreeItem("");
	if wbook.IsFolder(item1) :
		item2 = wbook.GetFirstTreeItem(item1);
		# ...
	

GetPrevTreeItem(str path) -> str

Returns the previous sibling tree item (a worksheet or a folder) for the specified worksheet tree item.

Example:

	wbook = gscalc.ActiveWorkbook();
	item1 = wbook.GetFirstTreeItem("");
	item2 = wbook.GetNextTreeItem(item1);
	item3 = wbook.GetPrevTreeItem(item2);
	# item1 == item3 if there are at least two sibling items in the main folder of the worksheet tree.
	item1 = wbook.GetFirstTreeItem("folder1\\subfolder2");
	item2 = wbook.GetNextTreeItem(item1);
	item3 = wbook.GetPrevTreeItem(item2);
	# item1 == item3 if there are at least two sibling items in the "subfolder2" folder.
	

GetNextTreeItem(str path) -> str

Returns the next sibling tree item (a worksheet or a folder) for the specified worksheet tree item.

Example:

	wbook = gscalc.ActiveWorkbook();
	item1 = wbook.GetFirstTreeItem("");
	item2 = wbook.GetNextTreeItem(item1);
	item3 = wbook.GetPrevTreeItem(item2);
	# item1 == item3 if there are at least two sibling items in the main folder of the worksheet tree.
	item1 = wbook.GetFirstTreeItem("folder1\\subfolder2");
	item2 = wbook.GetNextTreeItem(item1);
	item3 = wbook.GetPrevTreeItem(item2);
	# item1 == item3 if there are at least two sibling items in the "subfolder2" folder.
	

GetParentFolder(str path) -> str

Returns the full path of the folder that contains the specified worksheet tree item (either a folder or a worksheet). If treeItem is top/root element, an empty string is returned.

Example:

	wbook = gscalc.ActiveWorkbook();
	item = wbook.GetFirstTreeItem("folder1\\subfolder2");
	parent = wbook.GetParentFolder(item);
	# parent == "folder1\subfolder2"
	

IsWorksheet(str path) -> int

Returns the logical True value id the specified worksheet tree item is a worksheet. Otherwise False is returned.

Example:

	wbook = gscalc.ActiveWorkbook();
	check1 = wbook.IsWorksheet("folder1\\sheet10");
	check2 = wbook.IsWorksheet("abc");
	

IsFolder(str path) -> int

Returns the logical True value id the specified worksheet tree item is a folder. Otherwise False is returned.

Example:

	wbook = gscalc.ActiveWorkbook();
	check1 = wbook.IsFolder("folder1\\sheet10");
	check2 = wbook.IsFolder("abc");
	

ExpandFolder(str folder) -> bool

Expand the specified folder in the worksheet tree window.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.ExpandFolder("folder1");
	

CollapseFolder(str folder) -> bool

Collapse the specified folder in the worksheet tree window.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.ColapseFolder("folder1");
	

SelectTreeItem(str path) -> bool

Changes selection in the worksheet tree window. The new selected tree item is specified by the full path argument. If it points to a worksheet, the current active worksheet is changed automatically as well.
If path is an empty string, the top/root folder is selected.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.SelectTreeItem("sheet1");
	wsheet = wbook.GetActiveWorksheet();
	wsheet.InsertData("b5", "data entered in sheet1!b5", True);
	wbook.SelectTreeItem("sheet2");
	wsheet.InsertData("b5", "data entered in sheet2!b5", True);
	

InsertFolder(str name) -> bool

Inserts a new folder into the current worksheet tree folder. The name argument must not include tree path elements.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.SelectTreeItem("folder2");
	wbook.InsertFolder("nested-folder3");
	

InsertWorksheet(str name) -> bool

Inserts a new worksheet into the current worksheet tree folder. The name argument must not include tree path elements.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.SelectTreeItem("");
	wbook.InsertFolder("sheet1");
	

DeleteTreeItem() -> bool

Deletes the currently selected worksheet tree item (which can be a single worksheet or a folder containing other folders and worksheets).

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.SelectTreeItem("folder4");
	wbook.DeleteTreeItem();
	wbook.SelectTreeItem("folder5\\sheet1");
	wbook.DeleteTreeItem();
	

MoveTreeItem(str sourcePath, str targetPath) -> bool

Moves a worksheet tree item performing the equivalent of the drag-and-drop operation. If the targetPath specifies a worksheet, the moved item(s) are insert before it in the same folder.
If the targetPath specifies a folder, the moved item(s) are inserted as the last item(s) in that folder. An empty targetPath specifies the top/root folder.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.MoveTreeItem("folder1\\sheet11", "folder2");
	wbook.MoveTreeItem("folder1\\sheet10", "");
	

CopyTreeItem(str sourcePath, str targetPath) -> bool

RenameTreeItem(str path) -> bool

Changes the name of the currently selected worksheet tree item (except the top/root item).

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.SelectTreeItem("folder4");
	wbook.RenameTreeItem("folder_4");
	wbook.SelectTreeItem("pivot tables\\customers")
	wbook.RenameTreeItem("new customers");
	

GetNamedRangeCount()

Returns the number of defined named ranges.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.GetNamedRangeCount();
	

GetNamedRange(index, propertyName)

Returns the name and cell range of the named expression specified by index. The type of the returned string is determined by the propertyName argumement and can be "name" or "range".

Example:

	wbook = gscalc.ActiveWorkbook();
	name = wbook.GetNamedRange(2, "name");
	cell = wbook.GetNamedRange(2, "range");
	

SetNamedRange(index, rangeName, range)

Set the existing named range specified by index.

Example:

	wbook = gscalc.ActiveWorkbook();
	if wbook.GetNamedRangeCount() > 3 :
		wbook.SetNamedRange(1, "start", "a10");
		wbook.SetNamedRange(2, "name", sheet1!c4);
		wbook.SetNamedRange(3, "sales", "\"d:\\[sample.gsc]Folder1\"!$A$1:$E$5");
	

AddNamedRange(rangeName, range)

Adds a new named range specified by index.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.AddNamedRange("start", "a10");
	wbook.AddNamedRange("name", sheet1!c4);
	wbook.AddNamedRange("sales", "\"d:\\[sample.gsc]Folder1\"!$A$1:$E$5");
	

RemoveNamedRange(index)

Removes an existing named range specified by index.

Example:

	wbook = gscalc.ActiveWorkbook();
	while wbook.GetNamedRangeCount() >= 1 :
		wbook.RemoveNamedRange(1);
	

RemoveAllNamedRanges()

Removes all defined named ranges.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.RemoveAllNamedRanges();
	

Save() -> bool

Saves the workbook using the current file format and file path. If this is a new workbook, the Save As dialog box is displayed.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.Save();
	

SaveAs(str filePath) -> bool

Saves the current workbook to a new file. If path is an empty string, Save As dialog box is displayed.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.SaveAs("d:\\wbook1.gsc");
	

SaveAsPDFFile(str filePath, bool saveAllWorksheets) -> bool

Saves the current workbook to the specified PDF file. If the logical saveAllWorksheets value is True, all worksheets are saved and the tree structure is preserved in that PDF file.
If saveAllWorksheets is False, only the current/active worksheet is saved.
When saving to PDFs the current worksheets print/page settings determine the layout of PDF pages.
The method doesn't change the file path information or the modification state of the original workbook.
If path is an empty string, the Save As dialog box is displayed.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.SaveAsPDFFile("d:\\copy_of_wbook1.pdf");
	

SaveAsExcelFile(str filePath) -> bool

Saves the current workbook as a new Excel XML file.
If path is an empty string, the Save As dialog box is displayed.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.SaveAsExcelFile("d:\\wbook1.xml");
	

SaveAsTextFile(str filePath, bool dialogBox, TextParams params) -> bool

Saves the current workbook as a new text file using the provided TextParams object. If showDialogBox is True, the Save Text File dialog box is displayed.
If path is an empty string, the Save As dialog box is displayed.

Example:

	wbook = gscalc.ActiveWorkbook();
	textParams = gscalc.CreateTextParams();
	textParams.setSeparator("\t"); # tab-separeted values
	textParams.setQuotingSymbol("\"");
	textParams.setEncoding("utf8");
	wbook.SaveAsTextFile("d:\\wbook1.txt", False, textParams);
	wbook.SaveAsTextFile("d:\\wbook2.txt", True, textParams);
	

SaveAsXBaseFile(str filePath, bool dialogBox, XBaseParams params) -> bool

Saves the current workbook as a new xBase file using the provided XBaseParams object. If showDialogBox is True, the Save xBase File dialog box is displayed and it contains a suggested set of fields based on the data the worksheet contains.
If path is an empty string, the Save As dialog box is displayed.

Example:

	wbook = gscalc.ActiveWorkbook();
	xBaseParams = gscalc.CreateXBaseParams();
	xBaseParams.setFormat("dbaseIV");
	xBaseParams.AddField("item", "C", 40, 0);
	xBaseParams.AddField("price", "N", 5, 2);
	xBaseParams.setEncoding("windows");
	wbook.SaveAsXBaseFile("d:\\wbook1.dbf", False, xBaseParams);
	wbook.SaveAsXBaseFile("d:\\wbook2.dbf", True, xBaseParams);
	

Reload() -> bool

Reloads the workbook. All changes are discarded.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.Reload();
	

Close() -> bool

Closes the workbook. If the modified property is True, users are prompted to save it.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.Close();
	counter = wbook.GetWorksheetCount();
	

GetFileInfo(str filePath, int type) -> str

# 1 - size, 2 - mod. dateReleaseFile

modified.

Example:

	# file size in bytes
	size = gscalc.GetFileInfo("c:\\file01.gsc", 1);
	# last modification date in the format YYYY-MM-DD (YYYY-MM-DDTHH:MM:SS)
	modificationData = gscalcc.GetFileInfo("c:\\file01.gsc", 2);
	

ReleaseFile() -> str

Detaches and closes the currently open workbook file. The workbook and its window remain open and you keep on editing it allowing other programs to access that file at the same time.
If you try to save it without calling the AttachFile() function first, the Save As dialog box will be displayed.

Example:

	wbook = gscalc.ActiveWorkbook();
	path = wbook.ReleaseFile();
	

AttachFile(str filePath) -> int

Attaches previously detached file and open it. Returns 1 if a given file was modified after ReleaseFile(), 0 if not and -1 if the file can't be opened and attached

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.AttachFile("c:\\text_file01.csv");
	

MergeRows(MergeParams params) -> bool

Merges/adds rows from other GS-Calc *.gsc files and tables to the current worksheet. The mergeParams parameters are created using the CreateMergeParams() method.
For all parameters see the MergeParams description.

Example:

	wbook = gscalc.ActiveWorkbook();
	merge = gscalc.CreateMergeParams();
	# merge records from all *.gsc files with names starting with "gsc_file"
	merge.setPath("c:\\gsc_file*.gsc");
	merge.setTable("");
	wbook.MergeRows(mergeParams)
	

MergeRowsFromODSFile(MergeParams params) -> bool

Merges/adds rows from other *.ods files and tables to the current worksheet. The mergeParams parameters are created using the CreateMergeParams() method.
For all parameters see the MergeParams description.

Example:

	wbook = gscalc.ActiveWorkbook();
	merge = gscalc.CreateMergeParams();
	# merge records from all *.ods files with names starting with "ods_file"
	merge.setPath("c:\\ods_file*.ods");
	merge.setTable("");
	wbook.MergeRowsFromODSFile(mergeParams)
	

MergeRowsFromTextFile(MergeParams params, TextParams params) -> bool

Merges/adds rows from other *.txt files to the current worksheet. The mergeParams parameters are created using the CreateMergeParams() method and textParams - with the CreateTextParams() method.
For all parameters see the MergeParams and TextParams descriptions.

Example:

	wbook = gscalc.ActiveWorkbook();
	textParams = gscalc.CreateTextParams();
	textParams.setSeparator(",");
	mergeParams = gscalc.CreateMergeParams();
	# merge records from all *.csv files with names starting with "csv_file"
	merge.setPath("c:\\csv_file*.csv");
	merge.setTable("");
	wbook.MergeRowsFromTextFile(mergeParams, textParams)
	

MergeRowsFromExcelFile(MergeParams params) -> bool/a>

Merges/adds rows from other *.xlsx files and tables to the current worksheet. The mergeParams parameters are created using the CreateMergeParams() method.
For all parameters see the MergeParams description.

Example:

	wbook = gscalc.ActiveWorkbook();
	merge = gscalc.CreateMergeParams();
	# merge records from all *.xlsx files with names starting with "xlsx_file"
	merge.setPath("c:\\xlsx_file*.xlsx");
	merge.setTable("");
	wbook.MergeRowsFromExcelFile(mergeParams)
	

MergeRowsFromXBaseFile(MergeParams params, XBaseParams params) -> bool

Merges/adds rows from other dBaseIV *.dbf files and tables to the current worksheet. The mergeParams parameters are created using the CreateMergeParams() method and xBaseParams - CreateXBaseParams.
For all parameters see the MergeParams description.

Example:

	wbook = gscalc.ActiveWorkbook();
	merge = gscalc.CreateMergeParams();
	# merge records from all *.dbf files with names starting with "dbf_file"
	merge.setPath("c:\\dbf_file*.dbf");
	merge.setTable("");
	xbaseParams = gscalc.CreateXBaseParams();
	xbaseParams.setEncoding("windows");
	wbook.MergeRowsFromXBaseFile(mergeParams)
	

MergeRowsFromMySQLFile(MergeParams params) -> bool

MergeRowsFromSQLiteFile(MergeParams params) -> bool

MergeTable(str filePath, str tablePath) -> bool

Merges/adds tables from other GS-Calc *.gsc files to the current workbook and currently selected folder.
"Path" specifies a file(s) with tables to merge. The path can contain a file name with wildcard (*, ?) characters, enabling you to merge tables from multiple files from a given folder or all files from that folder.
If no table name is specified (table="" / NULL), then the default/current table from a given file is added

Example:

	wbook = gscalc.ActiveWorkbook();
	# merge tables from all *.gsc files with names starting with "gsc_file"
	wbook.MergeTable("c:\\gsc_file*.gsc", "customers");
	

MergeTableFromODSFile(str filePath, str table) -> bool

Merges/adds tables from other *.ods files to the current workbook and currently selected folder.
"Path" specifies a file(s) with tables to merge. The path can contain a file name with wildcard (*, ?) characters, enabling you to merge tables from multiple files from a given folder or all files from that folder.
If no table name is specified (table="" / NULL), then the default/current table from a given file is added

Example:

	wbook = gscalc.ActiveWorkbook();
	# merge tables from all *.ods files with names starting with "ods_file"
	wbook.MergeTable("c:\\ods_file*.ods", "customers");
	

MergeTableFromTextFile(str filePath, str table, TextParams params) -> bool

Merges/adds tables from other text files to the current workbook and currently selected folder.
"Path" specifies a file(s) with tables to merge. The path can contain a file name with wildcard (*, ?) characters, enabling you to merge tables from multiple files from a given folder or all files from that folder.
If no table name is specified (table="" / NULL), then the default/current table from a given file is added

Example:

	textParams = gscalc.CreateTextParams();
	textParams.setSeparator(",");
	wbook = gscalc.ActiveWorkbook();
	# merge tables from all *.csv files with names starting with "csv_file"
	wbook.MergeTable("c:\\csv_file*.csv", "", textParams);
	

MergeTableFromExcelFile(str filePath, str table) -> bool

Merges/adds tables from other *.xlsx files to the current workbook and currently selected folder.
"Path" specifies a file(s) with tables to merge. The path can contain a file name with wildcard (*, ?) characters, enabling you to merge tables from multiple files from a given folder or all files from that folder.
If no table name is specified (table="" / NULL), then the default/current table from a given file is added

Example:

	wbook = gscalc.ActiveWorkbook();
	# merge default tables from all *.xlsx files with names starting with "xlsx_file"
	wbook.MergeTable("c:\\xlsx_file*.xlsx", "");
	

MergeTableFromXBaseFile(str filePath, str table, XBaseParams params) -> bool

Merges/adds tables from other dBaseIV *.dbf files to the current workbook and currently selected folder.
"Path" specifies a file(s) with tables to merge. The path can contain a file name with wildcard (*, ?) characters, enabling you to merge tables from multiple files from a given folder or all files from that folder.
If no table name is specified (table="" / NULL), then the default/current table from a given file is added

Example:

	xBaseParams = gscalc.CreateXBaseParams();
	xBaseParams.encoding = "windows";
	wbook = gscalc.ActiveWorkbook();
	# merge tables from all *.dbf files with names starting with "dbf_file"
	wbook.MergeTable("c:\\dbf_file*.dbf", "");
	

MergeTableFromMySQLFile(str filePath, str table) -> bool

MergeTableFromSQLiteFile(str filePath, str table) -> bool

SetFilePassword(bool enable, str cryptMethod, str oldPassword, str newPassword) -> bool

Sets, modifies or removes password protection for the workbook.
If the logical enable argument is True, the password protection is added, if it's False, the protection is removed.
The method argument can currently be only the "blowfish" encryption method name.
If the workbook is already password protected, the oldPassword argument must contain the existing password.
If enable is True, the newPassword argument argument must contain a new password consisting of at least 6 characters.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.SetFilePassword(True, "blowfish", "Df8ER1", "97uYwp");
	wbook = gscalc.NewWorkbook();
	wbook.SetPassword(True, "blowfish", "", "97uYwp");
	

SetCellPassword(bool enable, str oldPassword, str newPassword) -> bool

Sets, modifies or removes password protection for idividual cells.
Once this password is set, the Format > Protect command can be used to set the cell protection.

If the logical enable argument is True, the password protection is added, if it's False, the protection is removed.
If enable is True, the newPassword argument argument must contain a new password consisting of at least 6 characters.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.SetCellPassword(True, "Df8ER1", "97uYwp");
	

SetTreePassword(bool enable, str oldPassword, str newPassword) -> bool

Sets, modifies or removes password protection for the worksheet tree structure and view splitters.
If the logical enable argument is True, the password protection is added, if it's False, the protection is removed.
If enable is True, the newPassword argument argument must contain a new password consisting of at least 6 characters.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.SetTreePassword(True, "Df8ER1", "97uYwp");
	

UpdateAllWorksheets() -> bool

Updates all formulas in all worksheets in this workbook. (Same as the Update All - F9 command.)

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.UpdateAllWorksheets();
	wbook.WaitForUpdate(); # to allow the background updating to complete before further actions
	

UpdateActiveWorksheet() -> bool

Updates all formulas in the active worksheet. (Same as the Update Worksheet Shift+F9 command.)

GS-Calc enables you to load/save quickly extremely large files and use multicore calculations for any formulas using dynamic references because it doesn't pre-build calculation trees. However, the disadvantage of this is that if you use the UpdateAllWorksheets() method, GS-Calc will be unconditionally updating all formulas in all worksheets, no matter whether the current data change requires it.
Setting the updateMode to manual and using sequences of the UpdateActiveWorksheet() and/or UpdateAllWorksheetRegion() methods relevant to your worksheets design, you can greatly increase the update speed.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.UpdateActiveWorksheet();
	wbook.WaitForUpdate(); # to allow the background updating to complete before further actions
	

UpdateActiveWorksheetRegion(str range) -> bool

Updates all formulas in the specified range in the active worksheet.

GS-Calc enables you to load/save quickly extremely large files and use multicore calculations for any formulas using dynamic references because it doesn't pre-build calculation trees. However, the disadvantage of this is that if you use the UpdateAllWorksheets() method, GS-Calc will be unconditionally updating all formulas in all worksheets, no matter whether the current data change requires it.
Setting the updateMode to manual and using sequences of the UpdateActiveWorksheet() and/or UpdateAllWorksheetRegion() methods relevant to your worksheets design, you can greatly increase the update speed.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.UpdateActiveWorksheetRegion("a5:b1000000");
	wbook.WaitForUpdate();  # to allow the background updating to complete before further actions
	wbook.UpdateActiveWorksheetRegion("g5:m1000000");
	wbook.WaitForUpdate();  # to allow the background updating to complete before further actions
	

WaitForUpdate() -> None

If the background updating mode in turned on and there is an updating process running, the method waits till that process completes.
If the background updating mode is turned off, the method returns immediately.
Performing any editing action before the update completes restarts the updating process.
Some actions (like saving) can't be carried out before the pending update completes.

For efficiency reasons it's recommended that you set the updateMode property to "manual" before performing a massive data editing/entering actions.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.UpdateAllWorksheets();
	wbook.WaitForUpdate();
	

MaximizeWindow() -> None

Maximizes the workbook window.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.MaximizeWindow();
	

RestoreWindow() -> None

Restores the previous size of the workbook window after it's maximized.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.RestoreWindow();
	

setModified(bool value) -> bool / getModified() -> bool

A logical value specifying whether the contents of the workbook was modified. It's managed automatically by the program. Typically, modifying it explicitly might be necessary only to avoid notifications about closing an unsaved workbook.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.setModified(False);
	wbook.Close()
	

setUpdateMode(str mode) -> bool / getUpdateMode() -> str

Specifies whether formulas are updated automatically or manually. The method accepts the following strings as its argument:

For more details, please see the Settings help topic.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.setUpdateMode("manual");
	

setUpdateThreads(str threads) -> bool / getUpdateThreads() -> str

Specifies the number of threads/CPUs used when updating workbook formulas:

For more details, please see the Settings help topic.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook.setUpdateThreads(4);
	# ...
	wbook.setUpdateThreads("default");
	

Application

CreateXBaseParams()

Creates and returns an object containing xBase (dBase, Clipper, FoxPro) file format details. The XBaseParams object is then used to retrieve header/fields information of an existing opened database file or to create header/fields structure for a new database file.

Example:

	wbook = gscalc.ActiveWorkbook();
	xBaseParams = gscalc.CreateXBaseParams();
	xBaseParams.setFormat("dbaseIV");
	xBaseParams.AddField("item", "C", 40, 0);
	xBaseParams.AddField("price", "N", 5, 2);
	xBaseParams.setEncoding("windows");
	wbook.SaveAsXBaseFile("d:\\wbook1.dbf", False, xBaseParams);
	wbook.SaveAsXBaseFile("d:\\wbook2.dbf", True, xBaseParams);
	

CreateTextParams()

Creates and returns an object containing text file format details. The TextParams object is then used to open existing text files and to create new ones.

Example:

	wbook = gscalc.ActiveWorkbook();
	textParams = gscalc.CreateTextParams();
	textParams.setSeparator("\t"); # tab-separeted values
	textParams.setQuotingSymbo("\"");
	textParams.setEncoding("utf8");
	wbook.SaveAsTextFile("d:\\wbook1.txt", False, textParams);
	wbook.SaveAsTextFile("d:\\wbook2.txt", True, textParams);
	

CreateMergeParams

A set of parameters used by rows-merging functions.

ActiveWorkbook(str path, str password) -> Workbook

Returns the Workbook object corresponding to the workbook that contains the executed script or (if the script is not a part of the workbook contents) to the current workbook.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook2 = gscalc.NewWorkbook();
	wbook3 = gscalc.OpenWorkbook("d:\\sales2013\\june.gsc", "");
	

NewWorkbook() -> Workbook

Creates a new workbook and returns the corresponding Workbook object.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook2 = gscalc.NewWorkbook();
	wbook3 = gscalc.OpenWorkbook("d:\\sales2013\\june.gsc", "");
	

OpenWorkbook(str path) -> Workbook

Opens an existing workbook in the *.gsc or *.odf file format and returns the corresponding Workbook object.
If path is an empty string, the Open File dialog box is displayed.

Example:

	wbook = gscalc.ActiveWorkbook();
	wbook2 = gscalc.NewWorkbook();
	wbook3 = gscalc.OpenWorkbook("d:\\sales2013\\june.gsc", "");
	wbook4 = gscalc.OpenWorkbook("d:\\sales2013\\june.ods", "FE2OkP");
	

OpenTextFile(str path, bool dialogBox, TextParams params) -> Workbook

Opens an existing text file and returns the corresponding Workbook object. If showDialogBox is True, the Open Text File dialog box is displayed.
If path is an empty string, the Open File dialog box is displayed.

Example:

	textParams = gscalc.CreateTextParams();
	textParams.setSeparator("\t"); # tab-separeted values
	textParams.setQuotingSymbol("\"");
	textParams.setEncoding("utf8");
	wbook1 = gscalc.OpenTextFile("d:\\wbook1.txt", False, textParams);
	wbook2 = gscalc.OpenTextFile("d:\\wbook2.txt", True, textParams);
	

OpenExcelFile(str path) -> Workbook

Opens an existing workbook in the Excel *.xlsx file format and returns the corresponding Workbook object.
If path is an empty string, the Open File dialog box is displayed.

Example:

	wbook = gscalc.OpenExcelFile("d:\\sales2020\\june.xlsx");
	

OpenXBaseFile(str path, bool dialogBox, XBaseParams params) -> Workbook

Opens an existing xBase file and returns the corresponding Workbook object. If showDialogBox is True, the Open xBase File dialog box is displayed.
If path is an empty string, the Open File dialog box is displayed.

Example:

	xBaseParams = gscalc.CreateXBaseParams();
	xBaseParams.setFormat("dbaseIV");
	wbook1 = gscalc.OpenXBaseFile("d:\\wbook1.dbf", False, xBaseParams);
	xBaseParams.setFormat("clipper");
	wbook2 = gscalc.OpenXBaseFile("d:\\wbook2.dbf", True, xBaseParams);
	

OpenMySQLFile(str path) -> Workbook

OpenSQLiteFile(str path) -> Workbook

LoadProfile(str path) -> bool

Loads profile information from the specified XML file. If path is an empty string, the Open File dialog box is displayed.

Example:

	gscalc.LoadProfile("d:\\profiles\\prof1.xml");
	

SaveProfile(str path) -> bool

Save profile information to the specified XML file. If path is an empty string, the Save dialog box is displayed.

Example:

	gscalc.SaveProfile("d:\\profiles\\prof1.xml");
	

GetWorkbookCount() -> int

Returns the number of open workbooks.

Example:

	counter = gscalc.GetWorkbookCount();
	

CloseAllWorkbooks() -> bool

Closes all open workbooks.

Example:

	wbook = gscalc.ThisWorkbook();
	gscalc.CloseAllWorkbooks();
	counter = wbook.GetWorksheetCount();
	

TileWorkbooks() -> None

Tiles open workbook windows vertically or horizontally.

Example:

	gscalc.TileWorkbooks(True);
	gscalc.TileWorkbooks(False);
	

MaximizeAppWindow() -> None

Maximizes the application window.

Example:

	gscalc.MaximizeAppWindow();
	

MinimizeAppWindow() -> None

Minimizes the application window.

Example:

	gscalc.MinimizeAppWindow();
	

RestoreAppWindow() -> None

Restores the previous size and position of the application window after it's minimized or maximized.

Example:

	gscalc.RestoreAppWindow();
	

GetFilePath(bool saveAs, str title, str folder, str name, str ext) -> bool, str

Displays the "File" dialog box and returns selected file path.

The dialog box returns the full file path. If the file selction is cancelled, an empty string is returned.

Example:

	openFilePath = gscalc.GetFilePath(False, "Open XLSX File", "d:\\", "d:\\newfile.xlsx", ".xlsx");
	

GetFolder(str title, str folder) -> bool, str

Displays the (file) "Folder" dialog box and returns selected folder path.

The dialog box returns the full folder path. If the folder selection is cancelled, an empty string is returned.

Example:

	folderPath = gscalc.GetFolder("Select Folder", "d:\\");
	

MessageBox(str message, str buttons, int activeButton, str icon) -> bool, str

Displays a message box using the following arguments:

The method returns a text string representing the name of the clicked/pressed button:

Example:

	accepted, ret = gscalc.MessageBox("Open this file: calc1.gsc", "yes-no", 1, "question")
	if ret == "yes" :
		wbook = gscalc.OpenWorkbook("d:\\sales2013\\calc1.gsc", "");
		# ...
	

InputBox(str title, bool password, str initialValue) -> bool, str"

Displays a simple, one-line input box using the following arguments:

The method returns the entered text. If a use click the Cancel button, the 1st returned value is False.

Example:

	accepted, name = gscalc.InputBox("Enter your name", False, "");
	

Sleep(time)

Suspend the execution of the script for the specified time in milliseconds.

Example:

	gscalc.Sleep(5000);
	

SetStatusBarText

Specifies the text displayed in the 1st pane of status bar.

Example:

	gscalc.SetStatusBarText("Executing script...");
	

Related Topics

Samples