Restructure: Split Worksheet
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.
Split by Reference Column according to the value and condition both requires 2021.
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>]>;
4. wsplit mode:=ref ref:=[Book1]Sheet1!D refmode:=change turnpoint:=pregroup refsort:=desc;
Please refer to the page for additional option switches when accessing the x-function from script
Display Name |
Variable Name |
I/O and Type |
Default Value |
Description |
---|---|---|---|---|
Input Worksheet | iw |
Input Worksheet |
|
Specify the range to be split. May be an entire worksheet or a column range. |
Split Mode | mode |
Input int |
|
Specify the way in which the input worksheet is split.
Option list:
|
Number of Columns | col |
Input int |
|
Available when Split Mode is By Number of Columns. Specify every n columns to create a new worksheet. |
Number of Rows | row |
Input int |
|
Available when Split Mode is By Number of Rows. Specify every n rows to create a new worksheet |
Column Label | label |
Input string |
|
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 |
|
Available when Split Mode is By Reference Columns. Specify column(s) containing grouping variable(s). |
Split | refmode |
Input int |
|
Specify how to split the worksheet rows according to the selected reference column. This control in only available when you selected single reference column in the Reference Columns box. Option list:
|
Tolerance | tol |
Input double |
|
Available when Split Mode is By Reference Columns and Split is By Value/By Value Change. Specify the tolerance which will take into account when dertmine if the numeric values change. |
Include Turning Point in | turnpoint |
Input int |
|
Specify how to deal with the turning points, to include them in the previous group or next group, when you selected By Direction Change for the Split control.
Option list:
|
Keep Reference Columns in Result | keepref |
Input int |
|
Output Reference Column data with split result. |
Sort Result by Reference Columns | refsort |
Input int |
|
Specify whether to sort the result rows according to the corresponding values in the reference column when you checked Keep Reference Columns in Result. Please note, this check box is only available for the Split control set to By Direction Change or By Direction Reset.
Option list:
|
Exclude Missing Value | missing |
Input int |
|
Exclude empty cells or cells containing Origin's missing value character ("--"), from output. |
Copy Column Formula to Result | copyform |
Input int |
|
If original worksheet has column formula, specify how to deal with the formula.
Option list:
|
Keep Short Name | sn |
Input int |
|
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 |
Retain 1st N Columns | fixcol |
Input int |
|
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 |
|
Keep the source worksheet intact. Otherwise the source worksheet is deleted. |
Show Sparklines | sparkline |
Input int |
|
Show Sparklines for the columns in the output worksheets. |
Output Worksheet | owp |
Output WorksheetPage |
|
Specify the output worksheet |
Preset Result Sheet Name | name |
Input string |
|
%N = ref name, LN if present, otherwise SN 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>]>; |
This X-Function is used to split one worksheet's columns into multiple sheets, according to the method specified.