jmcnamara / XlsxWriter

A Python module for creating Excel XLSX files.
https://xlsxwriter.readthedocs.io
BSD 2-Clause "Simplified" License
3.66k stars 631 forks source link

Bug: URLs disappear after 65530 #1043

Closed pickfire closed 9 months ago

pickfire commented 9 months ago

Current behavior

UserWarning: Ignoring URL '' since it exceeds Excel's limit of 65,530 URLS per worksheet.

After 65530 URLs are inserted into a worksheet, the rest are empty.

Expected behavior

The rest can be normal string but it should at least be visible even though it might no longer be a URL.

Sample code to reproduce

import xlsxwriter

workbook = xlsxwriter.Workbook('hello.xlsx')
worksheet = workbook.add_worksheet()
for i in range(100000):
    worksheet.write(i, 0, 'https://google.com')
workbook.close()

Environment

- XlsxWriter version: 3.0.9
- Python version: 3.11.7
- Excel version: WPS Spreadsheets 3.2.0.6370
- OS: OSX

Any other information

No response

OpenOffice and LibreOffice users

jmcnamara commented 9 months ago

Thanks for the detailed report.

The rest can be normal string but it should at least be visible even though it might no longer be a URL.

If the user wants that behaviour then they can probably come up with some scheme where they track the number of urls written and then switch to writing strings.

However, if the library did that automatically then it would cause a series of bug reports with people reporting that urls weren't written as urls.

So, the current situation with the warning and dropped urls is the lesser of two evils.

Ultimately the issue is that Excel has a bizarre and undocumented limit on the number of non-contiguous urls that it supports.

Closing this as can't fix.