OpenDocumentSpreadsheet
application/vnd.oasis.opendocument.spreadsheet
Magic Bytes
Offset: 0
50 4B
OpenDocument Spreadsheet (ODS) is an open standard file format for electronic spreadsheets maintained by the Organization for the Advancement of Structured Information Standards (OASIS). It is used for organizing, analyzing, and storing data in tabular form, serving as the default format for office suites like LibreOffice and Apache OpenOffice. While the XML-based structure is inherently safe, files may contain executable macros or external links that necessitate caution when opened from untrusted sources.
Validation Code
How to validate .ods files in Python
Python
def is_ods(file_path: str) -> bool:
"""Check if file is a valid ODS by magic bytes."""
signature = bytes([0x50, 0x4B])
with open(file_path, "rb") as f:
return f.read(2) == signature
How to validate .ods files in Node.js
Node.js
function isODS(buffer: Buffer): boolean {
const signature = Buffer.from([0x50, 0x4B]);
return buffer.subarray(0, 2).equals(signature);
}
Go
func IsODS(data []byte) bool {
signature := []byte{0x50, 0x4B}
if len(data) < 2 {
return false
}
return bytes.Equal(data[:2], signature)
}
API Endpoint
GET
/api/v1/ods
curl https://filesignature.org/api/v1/ods