2.16.3.11 Details of TreeNodes in Import Excel


Options

The Options tree specifies all import options for the impExcel X-Function.

Syntax: Options..SubTree.Treenode:=<value>

Example: Options.Names.FNameToSht:=1


Names

The Names branch of the Options tree specifies how to name the worksheet and workbook.

Syntax: Options.Names.Treenode:= <value>

Example:
//Rename worksheet with partial filename  :
Options.Names.FNameToSht:=1
Options.Names.FNameToShtFrom:=1
Options.Names.FNameToShtTo:=4


Treenode Label Type Default Description
AutoNames Auto Rename using file name int 0 If it is checked, Origin will use the default settings to rename the worksheet and workbook name, which is:
  • Use the whole filename (includes the file extension) as worksheet name.
  • Use the whole filename (includes the file extension) as workbook name if current workbook is empty or the import mode is Replace Existing Data.
FNameToBk Rename Book with (Partial) Filename int 1 Check this to use part of the filename as workbook name.
FNameToBkFrom Trim Filename From int 1 Specify the start of the name.
FNameToBkTo Trim Filename To int 0 Specify the end of the name.
FNameToBkLnOnly Rename Long Name for Book only int 0 Check this to rename the long name for book only.
FPathToBk Include File Path when Renaming Book int 0 Specify if the file path should be included for the workbook name.
FNameToBkComm Append Filename to Workbook Comment int 1 Specify if the filename should be appended to the workbook comment.
FPathToComm Include path when appending filename int 1 When this is checked, the import file path is appended to the workbook's command and/or Comments row.
Notes:

From Origin 8.6, minus value is supported in Trim Filename From and Trim Filename To to count the end of the name from the last character of the file name. It can be used to trim the file extension. For example, if you want to import an Excel book named sample.xls, you can specify as follow to trim the extension ".xls":

Trim Filename From: 1
Trim Filename To: -4


Script

The Script branch of the Options tree specifies the LabTalk scripts to run after file(s) being imported.

Syntax: options.scripts.Treenode:= <string>

Example:
//Plot second column for each imported file  :
options.scripts.ScriptAfterEachImport:="plotxy 2;";

//When all files being imported, loop over all worksheets in all workbooks and delete first 500 rows from column 1 to column 4.
options.scripts.ScriptAfterAllImport:=" doc -ef W { doc -e LW { range aa =1[1]:4[500]; del aa;}}";


Treenode Label Type Default Description
ScriptAfterEachImport Script after Each File Imported string "?" Specify LabTalk scripts that will be executed after each imported file.
ScriptAfterAllImport Script after All Files Imported string "?" Specify LabTalk scripts that will be executed only after all files being imported.