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.
In Brasil.IO we needed to create the following function to open a XLS file from fobj:
We may support it automatically in rows too, so the plugin will have the same interface as the others.