{"record":{"id":"d01a3e49ea2c5a49","repo":"qax-os/excelize","slug":"errtotalsheethyperlinks","errorCode":"ErrTotalSheetHyperlinks","errorMessage":"over maximum limit hyperlinks in a worksheet","messagePattern":"over maximum limit hyperlinks in a worksheet","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"errors.go","lineNumber":173,"sourceCode":"\tErrSheetNameSingleQuote = errors.New(\"the first or last character of the sheet name can not be a single quote\")\n\t// ErrSparkline defined the error message on receive the invalid sparkline\n\t// parameters.\n\tErrSparkline = errors.New(\"must have the same number of 'Location' and 'Range' parameters\")\n\t// ErrSparklineLocation defined the error message on missing Location\n\t// parameters\n\tErrSparklineLocation = errors.New(\"parameter 'Location' is required\")\n\t// ErrSparklineRange defined the error message on missing sparkline Range\n\t// parameters\n\tErrSparklineRange = errors.New(\"parameter 'Range' is required\")\n\t// ErrSparklineStyle defined the error message on receive the invalid\n\t// sparkline Style parameters.\n\tErrSparklineStyle = errors.New(\"parameter 'Style' value must be an integer from 0 to 35\")\n\t// ErrSparklineType defined the error message on receive the invalid\n\t// sparkline Type parameters.\n\tErrSparklineType = errors.New(\"parameter 'Type' value must be one of 'line', 'column' or 'win_loss'\")\n\t// ErrTotalSheetHyperlinks defined the error message on hyperlinks count\n\t// overflow.\n\tErrTotalSheetHyperlinks = errors.New(\"over maximum limit hyperlinks in a worksheet\")\n\t// ErrTransparency defined the error message for receiving a transparency\n\t// value exceeds limit.\n\tErrTransparency = errors.New(\"transparency value must be an integer from 0 to 100\")\n\t// ErrUnknownEncryptMechanism defined the error message on unsupported\n\t// encryption mechanism.\n\tErrUnknownEncryptMechanism = errors.New(\"unknown encryption mechanism\")\n\t// ErrUnprotectSheet defined the error message on worksheet has set no\n\t// protection.\n\tErrUnprotectSheet = errors.New(\"worksheet has set no protect\")\n\t// ErrUnprotectSheetPassword defined the error message on remove sheet\n\t// protection with password verification failed.\n\tErrUnprotectSheetPassword = errors.New(\"worksheet protect password not match\")\n\t// ErrUnprotectWorkbook defined the error message on workbook has set no\n\t// protection.\n\tErrUnprotectWorkbook = errors.New(\"workbook has set no protect\")\n\t// ErrUnprotectWorkbookPassword defined the error message on remove workbook\n\t// protection with password verification failed.\n\tErrUnprotectWorkbookPassword = errors.New(\"workbook protect password not match\")","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/qax-os/excelize/blob/f2483381fbfbe432a6baa98d48a1c277183f3285/errors.go#L155-L191","documentation":"ErrTotalSheetHyperlinks is returned by SetCellHyperLink when the worksheet already contains the maximum number of hyperlinks (TotalSheetHyperlinks = 65530; Excel's limit). cell.go:1168 checks the count before adding another.","triggerScenarios":"Calling f.SetCellHyperLink on a worksheet whose ws.Hyperlinks.Hyperlink slice already exceeds 65530 entries, e.g. in tests that pre-populate 65530 hyperlinks then add A65531.","commonSituations":"Bulk-linking every cell in a large generated report; importing data with a link per row far beyond Excel's 65,530 hyperlink limit; looping SetCellHyperLink without counting existing links.","solutions":["Count ws.Hyperlinks.Hyperlink before adding and stop below 65530","Consolidate links (one link per cell block or a summary sheet) instead of one per cell","Store the URLs as cell text or in a separate data sheet rather than as hyperlinks"],"exampleFix":"// before\nfor _, row := range rows {\n    f.SetCellHyperLink(\"Sheet1\", row.Cell, row.URL, \"External\")\n}\n// after\nfor i, row := range rows {\n    if i >= 65530 {\n        break // Excel hyperlink limit\n    }\n    f.SetCellHyperLink(\"Sheet1\", row.Cell, row.URL, \"External\")\n}","handlingStrategy":"validation","validationCode":"const maxLinks = 65530\nif linkCount[\"Sheet1\"] >= maxLinks {\n    return errors.New(\"worksheet hyperlink limit reached\")\n}","typeGuard":null,"tryCatchPattern":"if err := f.SetCellHyperLink(\"Sheet1\", cell, url, \"External\"); err != nil {\n    if errors.Is(err, excelize.ErrTotalSheetHyperlinks) {\n        // render remaining URLs as plain text instead\n    }\n    return err\n}","preventionTips":["Track link counts per sheet in bulk-generation loops","Stop below 65530 links per worksheet","Fall back to plain-text URLs or a link index sheet for large datasets"],"tags":["go","excelize","hyperlink","limit"],"backgroundTag":"worksheet-hyperlink-limit-exceeded","analyzedSha":"f2483381fbfbe432a6baa98d48a1c277183f3285","analyzedAt":"2026-09-02T01:26:19.299Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}