OriginLab Corporation - Data Analysis and Graphing Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis                     
Skip Navigation Links
All BooksExpand All Books
Quick HelpExpand Quick Help
ProgrammingExpand Programming

4.60 FAQ-872 Why can't I set column names in my script, e.g. using wks.addCol or wks.col.name?

Last Update: 5/15/2017

Starting with Origin 2017, workbooks support a simplified worksheet cell notation, similar to MS Excel. When this cell notation is turned on -- indicated by this icon in the upper-left corner of the workbook page Spreadsheet cell notation mode.png -- column Short Names are not editable and cannot be reordered.

While workbooks created with commands like win -t or the X-Function newbook have this column naming restriction turned off by default, any scripting operation that attempts column renaming or re-ordering on a book in which it IS turned on, will fail.

To prevent such errors you will need to insert the following before your column renaming code:

page.XLColName=0; // remove column short name restriction

If you need the same code to work on Origin versions prior to 2017, then you can insert this variation before your renaming code:

if(@v>=9.4) page.xlcolname=0; // remove column short name restriction if Origin version is 9.4(2017) or later

Related FAQs:

Keywords:short name restriction, spreadsheet cell notation, reorder


© OriginLab Corporation. All rights reserved.