Skip to main content
Parse ODS (OpenDocument Spreadsheet) files into the Data structure expected by @graphysdk/core.

fromODS

import { fromODS } from '@graphysdk/data-import-utils/ods';

const buffer = await file.arrayBuffer();
const data = await fromODS(buffer);

Signature

function fromODS(
  input: ArrayBuffer,
  options?: SpreadsheetParseOptions
): Promise<Data>

Options

sheet
string | number
default:"0"
Sheet to parse. Pass a sheet name (string) or a 0-based index (number). Defaults to the first sheet.
locale
VizLocale
default:"EN_US"
Locale for number parsing. Determines thousand/decimal separator conventions.
maxFileSize
number
default:"5"
Maximum allowed input size in megabytes. Throws an error if the input exceeds this limit.
maxRows
number
default:"100000"
Maximum number of data rows to process. Throws an error if the sheet contains more rows.
maxCells
number
default:"5000000"
Maximum total cells (rows x columns) to process. Throws an error if the limit is exceeded.

Examples

Select Sheet by Name

const data = await fromODS(buffer, { sheet: 'Revenue' });

Cell Value Handling

Cell typeResult
Numbernumber
Stringstring
Boolean1 or 0
DateISO 8601 string
FormulaComputed result
Rich textPlain text
Emptynull
fromODS uses the same XLSX-based parser under the hood. It works with modern .ods files that are actually in XLSX format (common in LibreOffice). Genuine native ODS format is not supported.