MID

MID(arg1, arg2, arg3) → { string }

Returns the characters from the middle of a text string, given a starting position and length.

Parameters:

Name Type Description
arg1 string

The text string from which to extract the characters.

arg2 number

The position of the first character to extract. The first text character is 1.

arg3 number

A number of the characters to extract.

Returns:

Type
string

Example

Copy code
builder.CreateFile("xlsx");
var oWorksheet = Api.GetActiveSheet();
var oFunction = Api.GetWorksheetFunction();
oWorksheet.GetRange("A1").SetValue(oFunction.MID("Online Office", 3, 4));
builder.SaveFile("xlsx", "MID.xlsx");
builder.CloseFile();

Resulting document