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

Feature/handle excel files with incorrect file extensions #127

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ollietulloch
Copy link
Contributor

Logic already exists to attempt to load an xlsx_file_with_xls_extension.xls, i.e. it's an excel file with the wrong excel extension.

This PR allows the NdrImport::File::Excel handler to load excel workbooks that have the incorrect file extension, for example .dat files received via Mesh. It creates a copy of the file with an updated file extension, taken from the NdrImport::Table.format. If the format provided still doesn't work, the workbook will fail to load in the usual way.

If the NdrImport::Table.format is an excel format, we do not create a new file. This causes a loop in the existing logic.

Files created are deleted once the workbook has either loaded, or failed to load.

Also included is some light refactoring/boyscouting of the load_workbook method, to appease rubocop.

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

Successfully merging this pull request may close these issues.

1 participant