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

[XLS] support file object #347

Open
turicas opened this issue Apr 16, 2020 · 0 comments
Open

[XLS] support file object #347

turicas opened this issue Apr 16, 2020 · 0 comments

Comments

@turicas
Copy link
Owner

turicas commented Apr 16, 2020

In Brasil.IO we needed to create the following function to open a XLS file from fobj:

import os
from pathlib import Path
from tempfile import NamedTemporaryFile
import rows

def import_xls(f_obj):
    content = f_obj.read()
    f_obj.seek(0)

    temp_xls = NamedTemporaryFile(suffix='.xls', delete=False)
    temp_xls.write(content)
    temp_xls.close()

    data = rows.import_from_xls(temp_xls)
    temp_file = Path(temp_xls.name)
    os.remove(temp_file)

    return data

We may support it automatically in rows too, so the plugin will have the same interface as the others.

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

1 participant