Skip to content

Commit

Permalink
Support extracting Libre office documents
Browse files Browse the repository at this point in the history
  • Loading branch information
VarshaUN committed Jan 14, 2025
1 parent db9dd08 commit 7811162
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/extractcode/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,14 @@ def extract_files(
logger.debug('extract:walk:recurse:extraction event: %(xevent)r' % locals())
yield xevent

def extract_libre_office_document(location, target):
""" Extract Libre Office documents (e.g., .ods files) as ZIP archives. """
if not zipfile.is_zipfile(location):
return
with zipfile.ZipFile(location, 'r') as zip_ref:
zip_ref.extractall(target)
print(f"Extracted Libre Office document from {location} to {target}")


def extract_file(
location,
Expand Down

0 comments on commit 7811162

Please sign in to comment.