Skip to content

Scraper

omniread.xlsx.scraper

Summary

XLSX scraper for OmniRead.

This module defines the scraper responsible for acquiring raw Office Open XML spreadsheet content from a backing store via a configured client.

The scraper does not interpret or parse the acquired bytes; it wraps them in the canonical Content model.

Classes

XlsxScraper

XlsxScraper(*, client: BaseXlsxClient)

Scraper for xlsx spreadsheet documents.

Notes

Responsibilities:

1
2
3
- Fetch raw xlsx bytes via the configured client.
- Wrap the payload in a canonical `Content` instance with the
  XLSX content type and source identifier.

Constraints:

1
2
- The scraper does not perform parsing or interpretation.
- Does not assume a specific storage backend.

Initialize the XLSX scraper.

Parameters:

Name Type Description Default
client BaseXlsxClient

Client responsible for retrieving raw spreadsheet bytes.

required
Functions
fetch
1
2
3
4
5
fetch(
    source: Any,
    *,
    metadata: Mapping[str, Any] | None = None
) -> Content

Fetch an xlsx document from the given source.

Parameters:

Name Type Description Default
source Any

Identifier of the spreadsheet source as understood by the configured client.

required
metadata Optional[Mapping[str, Any]]

Optional metadata to attach to the returned content.

None

Returns:

Name Type Description
Content Content

A Content instance containing raw xlsx bytes, source identifier, XLSX content type, and optional metadata.

Raises:

Type Description
Exception

Retrieval-specific errors raised by the client.