Skip to Content
CrabXL

Errors

The exceptions CrabXL raises and what they mean.

Every CrabXL error derives from CrabXLError and from the built-in exception that matches its meaning. Each has sheet, cell and part attributes when the location is known. File-system failures raise the built-in OSError subclasses, such as FileNotFoundError.

ExceptionAlso aRaised when
FileFormatErrorValueErrorThe file is not a valid XLSX package, or it is damaged.
InvalidInputErrorValueErrorAn argument is invalid: a bad reference, shape, name or value, or a value outside an Excel limit.
NotFoundErrorLookupErrorA sheet, table, defined name or other item does not exist.
ConversionErrorTypeErrorA value does not have the requested type.
UnsupportedErrorThe operation cannot be done without losing data.
LimitExceededErrorA safety limit stopped reading a file.
MemoryLimitErrorMemoryErrorThe memory budget was reached. A subclass of LimitExceededError.
StateErrorThe object is closed or finished, or a call comes in the wrong order.
import crabxl as xl

try:
    book = xl.Workbook.open(upload, limits="strict")
except (xl.FileFormatError, xl.LimitExceededError) as error:
    print("rejected:", error)

Saves that would lose data

A save raises UnsupportedError when it would remove content that CrabXL cannot keep, for example unknown attributes in a table you changed, or a digital signature that your edit invalidates. The message names the content. To save without it, open the workbook with data_loss="allow".