question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

XSSFHyperlink with more than 65.000 rows

See original GitHub issue

I’m having some problems when I use XSSFHyperlink and the file has more than 65.000 rows. When opening the file with Excel application, Excel throws an error message reporting that the file needs to be restored. After a while the file is opened but the hyperlink address is missing.

The code I’m using to create the link is:

IRow row = hoja.CreateRow(i + 1); row.CreateCell(col).SetCellValue(val.ToString()); XSSFHyperlink link = new XSSFHyperlink(HyperlinkType.Url); link.Address = val.ToString(); row.Cells[col].Hyperlink = link;

What I’ve tried so far:

  • Exporting less than 65.000 rows does not throw error, although opening the file is a bit slow with a high number of rows.

  • Just in case the original link data is causing errors, I’ve checked that modifing the hiperlink address to “https://www.google.es/” throws same error with more than 65.000 rows.

  • Reducing the number of columns does not avoid the error.

Attached is an example excel file with 4 columns and more than 67.000 rows

Any help will be appreciated. Thanks in advance

Informe_20211110112636.zip

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
SheetJSDevcommented, Mar 13, 2022

FYI Excel has a hard limit of 65530 links: https://support.microsoft.com/en-us/office/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3

To verify this, push it to the edge: https://jsfiddle.net/t6wvkzc7/ (You can fiddle with rows)

var rows = 65531
var ws = XLSX.utils.aoa_to_sheet(Array.from({length:rows}, (_,i) => ([String(i), i])));
for (let i = 0; i < rows; i++) {
  cell = ws[`A${i+1}`];
  cell.l = { Target: `https://sheetjs.com/${i}`, Tooltip: `Link ${i}` };
}
var wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
XLSX.writeFile(wb, `links.${rows}.xlsx`);

65529 rows is valid in Excel 2019: links.65529.xlsx

65531 rows is deemed corrupt: links.65531.xlsx

1reaction
jmmartininfoadexcommented, Feb 4, 2022

Looks your company is using NPOI. Can you contribue your use case to #705 ?

I already did it some weeks ago 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

To process more than 65536 rows xslx using POI
I use XSSF Reader event handler API and OPCpacakage classes for both upload and read. When a file contains 65536 rows or less...
Read more >
Apache POI creating excel having row greater than 65535
Hi, Can you please help me how to create an excel file having rows more than 65535, my requirement includes rows more than...
Read more >
Adding Hyperlinks using Macro fails to load more then ...
It appears to be a limit with Excel. I tried hard coding 2 separate For Loops - the first loop processed rows 2...
Read more >
Not able read large excel files with 1 million rows · Issue #73
I can verify that up to 194,000 rows can be read in just under 20 seconds using no more than 16MB of memory....
Read more >
How do I do a hyperlink that exceeds 255 characters?
The 255 character limit applies to how many characters you can put in one cell's formula bar but not necessarily to how long...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found