2.2.22 newsheet


Brief Information

Add a new sheet to workbook or matrix book

Command Line Usage

1. newsheet name:="ASCII Data";

2. newsheet cols:=6 xy:="XYE";

3. newsheet labels:="This is 1st column|This is 2nd Column|This is 3rd Column";

4. newsheet book:=Book1 template:=fft;

5. newsheet n:="my test" c:=5 r:=1000 xy:=Y o:=sname$ a:=0;//5x1000 sheet without activating

X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Workbook to Add Sheet book

Input

Page

<active>

Specifies the book to add a new sheet. The default is the active book.

Desired Sheet Name name

Input

string

"Sheet1"

Specifies the desired name for the new sheet.

Column Labels labels

Input

string

""

Specifies the long names of the columns in the new sheet. If there are multiple columns, the long names should be separated with "|".

Number of Columns cols

Input

int

-1

Specifies the number of columns in the new sheet.

Number of Rows rows

Input

int

-1

Specifies the number of rows in the new sheet.

Set Column Designations xy

Input

string

""

Specifies the column designations for all data columns. For example, if you enter XY, the plot designations of the columns will be set to the repeating pattern of "YXYXY...". In this string, each character corresponds to the designation of one column, as shown below:

'X' - X

'Y' - Y

'Z' - Z

'E' - Y Error

'L' - Label

'M' - X Error

'N' - Disregard

Template template

Input

string

"origin"

Specifies the template that will be used for creating the new sheet.

Use if sheet existed use

Input

int

0

If this variable is set to 1 and an existing sheet has the desired sheet name, the X-Function will not create a new sheet. If this variable is set to 0, a new sheet will be created even if a sheet with the desired name is found.

Sheet in template sheet

Input

string

""

Specifies the name of the sheet to use when the template has multiple sheets.

Actual Sheet Name outname

Output

string

sname$

Specifies the output for the actual sheet name.

New Matrix Sheet mat

Input

int

0

Specifies whether or not the new sheet is a matrix sheet. By default, this is set to false and this X-Function adds a workbook sheet.

Activate New Sheet active

Input

int

1

Activate the new sheet.

Description

The newsheet function adds a new sheet to a specified workbook/matrix book.

Examples

// New sheets can be created along with named columns
// If the active window is not a Workbook, create one
if( exist(%H) != 2 ) newbook;
// Get the name of the active Workbook
string name$ = page.name$;
// Create an extra workbook to show that command can specify target book
newbook;
// Repeat this command 8 times
// use:=0 will force enumeration of sheet names
repeat 8 {
   newsheet book:=name$ name:="Week 1" labels:="Time|Monday|Tuesday|Wednesday|Thursday|Friday" rows:=24 xy:=XYYYYY active:=0 use:=0;
}
// Switch to the Workbook we were modifying
win -a %(name$);
// and make the fourth sheet we created active
page.active$ = "Week 4";

Related X-Functions

newbook