PHPOffice / PHPExcel

ARCHIVED
Other
11.46k stars 4.19k forks source link

Trouble reading .xlsx files from .xlsm template #1328

Closed trgreen17 closed 6 years ago

trgreen17 commented 6 years ago

First, thanks for the great library. I have no trouble reading "regular" .xlsx files into an array, but I need to read files created from an .xlsm template. This template has dropdowns beside many of the cells to assure correct data entry (states, countries, booleans, etc.)

When I read an .xlsx file created from this template I get an odd array returned. The first element is an empty worksheet, when it should be an array of the column headings and then the rows. And the next two elements are additional sheets - the countries and states. Please note that the template only has one sheet in it, so I expected to get an array[0] which is the single sheet in the document, and then array[0][x] where 'x' is the header row plus the number of rows of data.

The really odd thing is that the only dropdowns that appear as extra sheets are the non-boolean ones. I have several Y/N dropdowns in the template and they don't appear in the returned array at all. Any help appreciated with this strange behavior.

Thanks, Tim

trgreen17 commented 6 years ago

I forgot to add that I'm working in Drupal 7, using the PHPExcel module.

The code I'm using is:

$excelData = phpexcel_import( $uploadedFile, FALSE, FALSE, array());

trgreen17 commented 6 years ago

Never mind, I figured it out. There was data validation that referenced a list in Excel. As soon as I removed that and entered dropdown choices manually it worked fine.