@graphysdk/core. The format is auto-detected from the file extension.
fromFile
Signature
FileParseOptions combines spreadsheet options with the hasHeader flag from delimited parsing.
Options
Path to the file. The extension determines the format.
Whether the first row contains column headers (CSV/TSV only). When
false,
columns are auto-named Column 1, Column 2, etc.Sheet to parse (spreadsheets only). Pass a sheet name or 0-based index.
Locale for number parsing. Determines thousand/decimal separator conventions.
Maximum allowed input size in megabytes. Throws an error if the input exceeds this limit.
Maximum number of data rows to process (spreadsheets only).
Maximum total cells to process (spreadsheets only).
Supported Extensions
| Extension | Format |
|---|---|
.csv | CSV |
.tsv, .tab | TSV |
.xlsx | XLSX |
.xls | XLS |
.ods | ODS |
Examples
With the AI SDK
Error Handling
fromFile uses Node.js fs.readFile under the hood and is not available in
the browser. For browser usage, use the format-specific parsers (fromCSV,
fromXLSX, etc.) after reading the file with the File API.
