dhatim / fastexcel

Generate and read big Excel files quickly
Other
647 stars 116 forks source link

Support for reading hyperlinks #314

Open diabolusss opened 11 months ago

diabolusss commented 11 months ago

Hello, Right now, I've been searching for an efficient way to read an Excel file and have found this excellent library. However, I can't find a way to extract hyperlinks, so I'm assuming this isn't implemented?

Will it have a big impact on performance if we add support for reading hyperlinks? (which can be disabled by default) As i see from sheet1.xml structure, hyperlinks are referenced in the end of file and url values are stored in sheet1.xml.rels. That means that we can get urls in parallel, but their coordinates only after reading the whole sheet1.xml file.

The real use case is that the government provides the sanction list, where hyperlinks are used to attach supporting documents via urls.

Please, see attached doc

https://www.gov.pl/attachment/a838b74b-6642-422c-b360-8d2638e59f1d

diabolusss commented 11 months ago

If you are interested in this feature, please review my changes and suggest improvements. I'll then make a pull request.

NB: However, it only works when reading all cells at once, for example, in an array. The use of Optional< Row > will significantly complicate matters.

        Optional<Sheet> sheet = excel.getSheet(0);
        Row[] rows = sheet.get().openStream().toArray(Row[]::new);