Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: The list of column names should have the same size as the list of column types. #264

Open
JamoCA opened this issue Oct 12, 2021 · 3 comments

Comments

@JamoCA
Copy link
Contributor

JamoCA commented Oct 12, 2021

I have a question regarding this error.

The list of column names should have the same size as the list of column types.

An XLS file was uploaded that had 23 column names. The data was populated, but only columns 1-19 contained content while columns 20-23 were intentionally empty. This use case doesn't happen that often, but it does happen. (Would this error have been thrown if the last column was populated and the proceeding 4 columns were empty?)

Is this an actual error? Is there any way to ignore it and import the data while treating the extra trailing, empty cells as "blank"?

NOTE: I understand the issue if it was reversed and there were 19 headers with 23 columns of data. I'm not sure if this should result in an error or if only the named columns should be imported (or if names should be auto-generated for empty columns.) We used a CFX tag about 10-15 years ago that (I believe) autogenerated COL_X headers for unnamed columns that it detected.

Thanks.

@JamoCA
Copy link
Contributor Author

JamoCA commented Oct 12, 2021

I upgraded to latest version and the error message (on a different XLS file) is:

The list of column names should have the same size as the list of column types.
Size of column names 19 is different from size of column types 18;

The last column in the Excel file is intentionally empty.

@cfsimplicity
Copy link
Owner

Hi James. That error doesn't come directly from the library but from the use of QueryNew() somewhere. I can't seem to replicate the conditions though. I've tried with a simple XLS created on the fly, but it works as expected in both Lucee and ACF2016:

path = "c:\temp\test.xls";
headerRow = [ "column one", "column two" ];
dataRow = [ "row 1 col 1 value" ];
spreadsheet.newChainable( "xls" )
 .addRow( headerRow )
 .addRow( dataRow )
 .write( path, true );
result = spreadsheet.read( src=path, headerRow=1, format="query" );
WriteDump( result );

20211013-1

Can you provide a test case that demonstrates the issue?

@cfsimplicity
Copy link
Owner

Meantime, I looked into the "reverse" case you mentioned and found problems exactly as you describe. See #265

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants