microsoft / microsoft/markitdown

convert_stream in case of xlsx and xls files is broken

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

Nobody has claimed this yet.

Dominant language
Python
Stars
186k
Forks
13.7k
Avg merge
1d 4h
Merged PRs (30d)
49

Description

f3 works but f2 does not with markitdown version 0.0.1a4

from markitdown import MarkItDown
md = MarkItDown()
p1= r'sample.pptx'
p2 = r'iris.xlsx'
from io import BytesIO

import re
def ftob(path):
    with open(path,"rb") as f:
        buff = BytesIO(f.read())
    return buff


md = MarkItDown()

def f3(path):
    result = md.convert(path)
    sheets = re.split(r"(?=## Sheet\d+)", result.text_content)

    for sheet in sheets:
        print(sheet.strip())

f3(p2)
#outputs None


def f2(path):
    byt = ftob(path)

    result = md.convert_stream(byt, file_extension=".xlsx")

    sheets = re.split(r"(?=## Sheet\d+)", result.text_content)

    for sheet in sheets:
        print(sheet.strip())


f2(p2)

#print sheets content

Contributor guide

No contributing guide indexed for this repository

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 at MarkItDown.convert_stream and reproduce the supplied comparison between convert(path) and convert_stream on iris.xlsx. Trace how the .xlsx file extension is handled for the stream, then verify that the stream conversion produces the same sheet content as the path conversion.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
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.