turicas / turicas/rows

[XLS] support file object

Open
#347 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement plugin
Dominant language
Python
Stars
886
Forks
137
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing rows.import_from_xls and comparing how the other format plugins handle file objects. The change is complete when XLS input accepts a file object through the same interface as the other plugins, without requiring callers to create a temporary file first.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.