Skip to content

Trailing spaces cause hard-to-spot errors #17

@4er4er4er

Description

@4er4er4er

A user wanted to read spreadsheet change.xlsx using these statements:

set Family;
set Unit; 
param Change {Family, Family, Unit}; 

table Family IN "amplxl" "change.xlsx": [Family] IN;
read table Family; 

table Unit IN "amplxl" "change.xlsx": [Unit] IN;
read table Unit;

table Change IN "amplxl" "change.xlsx": [Fam1, Fam2, Unit], Change; 
read table Change; 

But read table Change; gave this error:

	Error reading table Change with table handler amplxl:
	Could not find column Change in spreadsheet table header

The error occurs because the column heading Change has a trailing space. There are several ways we could consider dealing with this hard-to-spot error:

  • Remove trailing spaces from headers.
  • Include the trailing space in the error message (so that there would be two spaces after column Change in the above example).
  • Modify the error message so that the trailing space is more obvious, for example by putting quotes around the column name (so that it would be column "Change " in the above example).

There's a similar issue with trailing spaces in non-numeric data. Typically they do not prevent the spreadsheet data from being read, but lead to an error like invalid subscript Change[1,1,'A '] discarded at some later point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions