# 2.2.3.67 wsplit

## Contents

Worksheet: Split Worksheet

## Brief Information

Split worksheet by rows/columns or values in reference column

Minimum Origin Version Required: Origin 8.6. Split partial worksheet, split by Reference Columns and Preset Result Sheet Name require 2017b.

## Command Line Usage

 1. wsplit mode:=row row:=5; 

2. wsplit mode:=label label:=L keep:=1; 

3. wsplit mode:=ref ref:=[Book1]Sheet1!A name:=<[<%N_%V>]>; 

## Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input Worksheet iw

Input

Worksheet

<active>
Specify the range to be split. May be an entire worksheet or a column range.
Split Mode mode

Input

int

0
Specify the way in which the input worksheet is split.

Option list:

• col:By Number of Columns
Every n columns will be split into a new worksheet. Specify the number n in the col.
• row:By Number of Rows
Every n rows will be split into a new worksheet. Specify the number n in the row.
• label:By Column Label
Columns having the same label in a specified label row will be split into the same worksheet. Specify the column label row in the label.
• ref: By Reference Columns
Rows will be grouped and split to new worksheets, by value(s) in reference column(s).
Number of Columns col

Input

int

2
Available when Split Mode is By Number of Columns.Specify every n columns to create a new worksheet.
Number of Rows row

Input

int

2
Available when Split Mode is By Number of Rows. Specify every n rows to create a new worksheet
Column Label label

Input

string

This is only available when By Column Label is selected for Split Mode. Specify the label row using its Label Row character. Please refer to Column Label Row Characters for the single character of each column label row.
Reference Columns ref

Input

Range

<unassigned>
This is only available when Split Mode is By Reference Columns. Specify column(s) containing grouping variable(s).
Keep Reference Columns in Result keepref

Input

int

1
Output Reference Column data with split result.
Exclude Missing Value missing

Input

int

1
Exclude empty cells or cells containing Origin's missing value character ("--"), from output.
Keep Short Name sn

Input

int

0
Determine whether to keep the column short names after splitting to new worksheets.

Note that from Origin 2017, column Short Name is restricted to alphabetical order and it cannot be edited, by default. So the Keep Short Name option is hidden in the GUI (see note at the bottom of the page). The script user can output customized Short Names using sn:=1, regardless of the value of @SSG.

Retain 1st N Columns fixcol

Input

int

0
Available when Split Mode is By Number of Columns or By Column Label. Specify first n columns of the source Worksheet to keep them in all split result sheet. And these first n columns are excluded from splitting By Number of Columns or By Column Label.
Keep Source Worksheet keep

Input int

1
Keep the source worksheet intact. Otherwise the source worksheet is deleted.
Show Sparklines sparkline

Input int

1
Show Sparklines for the columns in the output worksheets.
Output Worksheet owp

Output

WorksheetPage

<new>
Specify the output worksheet
Preset Result Sheet Name name

Input

string

%V

%N = ref name, LN if present, otherwise SN
%C = ref dataset name
%M = ref Comment
%U = ref Units
%V = ref cell values (grouping variable)

Variables can be used in combination and incorporate arbitrary text (e.g. %N=%V). Whether used singly, in combination or with arbitrary text, variables must be protected as in the following example:

wsplit mode:=ref ref:=[Book1]Sheet1!A name:=<[<%N_%V>]>;

## Description

This X-Function is used to split one worksheet's columns into multiple sheets, according to the method specified.