qax-os/excelize · error

ErrWorkbookPassword

ErrWorkbookPassword

Error message

the supplied open workbook password is not correct

What it means

Sentinel error ErrWorkbookPassword returned by OpenFile when workbook decryption fails and a password was supplied via Options.Password; the underlying stream is encrypted and the given password did not decrypt it (wrap of a decryption failure).

Source

Thrown at errors.go:209

	ErrUnprotectWorkbookPassword = errors.New("workbook protect password not match")
	// ErrUnsupportedEncryptMechanism defined the error message on unsupported
	// encryption mechanism.
	ErrUnsupportedEncryptMechanism = errors.New("unsupported encryption mechanism")
	// ErrUnsupportedHashAlgorithm defined the error message on unsupported
	// hash algorithm.
	ErrUnsupportedHashAlgorithm = errors.New("unsupported hash algorithm")
	// ErrUnsupportedNumberFormat defined the error message on unsupported
	// number format expression.
	ErrUnsupportedNumberFormat = errors.New("unsupported number format token")
	// ErrUnsupportedPivotTableShowValuesAsType defined the error message on
	// receiving the unsupported pivot table "show values as" type.
	ErrUnsupportedPivotTableShowValuesAsType = errors.New("unsupported pivot table show values as type")
	// ErrWorkbookFileFormat defined the error message on receive an
	// unsupported workbook file format.
	ErrWorkbookFileFormat = errors.New("unsupported workbook file format")
	// ErrWorkbookPassword defined the error message on receiving the incorrect
	// workbook password.
	ErrWorkbookPassword = errors.New("the supplied open workbook password is not correct")
)

// ErrSheetNotExist defined an error of sheet that does not exist.
type ErrSheetNotExist struct {
	SheetName string
}

// Error returns the error message on receiving the non existing sheet name.
func (err ErrSheetNotExist) Error() string {
	return fmt.Sprintf("sheet %s does not exist", err.SheetName)
}

// newAddCommentError defined the error message on the comment already exist in
// the cell.
func newAddCommentError(cell string) error {
	return fmt.Errorf("comment already exist on cell %s", cell)
}

View on GitHub (pinned to f2483381fb)

Solutions

  1. Verify the password is the one the file was encrypted with
  2. Open without Options.Password if the file is not actually encrypted
  3. Confirm the file uses an encryption mechanism excelize supports (see ErrUnsupportedEncryptMechanism)
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at errors.go:209 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of qax-os/excelize@f2483381fb (2026-09-02). Data as JSON: /api/errors/6475fba88979fffa. Report an issue: GitHub.