Skip to content
Snippets Groups Projects

Passe de pylightxl à openpyxl pour l’import XLSX

Files

+ 0
15
@@ -68,21 +68,6 @@ async def import_file(path, archive=False):
return importers
# TODO: teach pylightxl how to do that, or use openpyxl instead (slower).
def parse_xlsx_modified(path):
with zipfile.ZipFile(path, "r") as f_zip:
try:
with f_zip.open("docProps/core.xml", "r") as file:
dom = parseString(file.read())
els = dom.getElementsByTagName("dcterms:modified")
if els:
return datetime.strptime(
els[0].firstChild.data, "%Y-%m-%dT%H:%M:%SZ"
).replace(tzinfo=timezone.utc)
except KeyError:
logger.warning("docProps/core.xml is missing")
def make_headers(headers):
"""Take an iterable of header candidates and return a set of folded strings.
Loading