jazzband / tablib

Python Module for Tabular Datasets in XLS, CSV, JSON, YAML, &c.
https://tablib.readthedocs.io/
MIT License
4.56k stars 588 forks source link

Extracting hidden url from hyperlink from .xlsx #564

Closed Yolter closed 9 months ago

Yolter commented 9 months ago

Hello, I need to parse a .xlsx file with a hyperlink hiding URL. Screenshot from 2023-09-28 13-00-35 I can do it with the openpyxl:

hide_url = ws.cell(row, col).hyperlink.target

But django-import-export use tablib and I can't find a solution with the tablib. Could you help with the solution?

Yolter commented 9 months ago

I found the solution: changed the receipt of the variable row_vals = [c.value if c.hyperlink is None else c.hyperlink.target for c in row] in tablib.formats._xlsx.XLSXFormat.import_sheet and turn off the 'read_only'