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

CSV processor needs an option to specify file type to override inference of type from the file extension #276

Open
szeke opened this issue May 12, 2018 · 1 comment

Comments

@szeke
Copy link
Contributor

szeke commented May 12, 2018

No description provided.

@linqyd
Copy link
Collaborator

linqyd commented May 13, 2018

Hey Pedro,
we cannot simply overwrite the inference of file type.

For example, we have an excel file but with the extension '.csv', if we pass the file_type="xlsx" to pyexcel_xlsx.get_data(), it will throw an exception. And I've checked the source code of pyexcel-xlsx, pyexcel automatically infer the file type based on extension, and in the documentation:
file_type – used only when filename is not a physial file name (means only use it when the file we wanna open is a stream file)

So, possible solution would be:
check the file extension and the passed 'file_type', if they don't match, throw an exception.

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

No branches or pull requests

2 participants