From 781116245239f658129b4cfdd58d8d736f080a06 Mon Sep 17 00:00:00 2001 From: Varsha U N Date: Tue, 14 Jan 2025 18:49:17 +0530 Subject: [PATCH] Support extracting Libre office documents --- src/extractcode/extract.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/extractcode/extract.py b/src/extractcode/extract.py index 8c547f2..1a30ab3 100644 --- a/src/extractcode/extract.py +++ b/src/extractcode/extract.py @@ -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,