@graphysdk/data-import-utils
v1.8.1-beta.1787333039234
Published
Parse CSV/TSV/JSON/spreadsheets into Graphy { columns, rows } data
Readme
@graphysdk/data-import-utils
Parse CSV, TSV, JSON, and spreadsheet files into the { columns, rows } shape used by Graphy charts and agents.
Install
npm install @graphysdk/data-import-utilsDocs
Usage
import { fromFile } from '@graphysdk/data-import-utils/file';
const data = await fromFile('sales.csv');
const spreadsheet = await fromFile('report.xlsx', { sheet: 'Revenue' });import { fromURL } from '@graphysdk/data-import-utils/url';
const data = await fromURL('https://example.com/sales.csv');Each format also has its own entry, so you only bundle what you need:
import { fromCSV } from '@graphysdk/data-import-utils/csv';
import { fromTSV } from '@graphysdk/data-import-utils/tsv';
import { fromXLSX } from '@graphysdk/data-import-utils/xlsx';
import { fromXLS } from '@graphysdk/data-import-utils/xls';
import { fromODS } from '@graphysdk/data-import-utils/ods';With the Agents SDK
import { fromFile } from '@graphysdk/data-import-utils/file';
import { GraphyAiSdk } from '@graphysdk/agents-sdk';
const data = await fromFile('revenue.csv');
const ai = new GraphyAiSdk({ apiKey: process.env.GRAPHY_API_KEY });
const result = await ai.generateGraph({
config: { data },
userPrompt: 'bar chart of revenue by company',
});Formats
| Format | Function | Input |
| ------ | ------------ | ------------- |
| CSV | fromCSV() | string |
| TSV | fromTSV() | string |
| XLSX | fromXLSX() | ArrayBuffer |
| XLS | fromXLS() | ArrayBuffer |
| ODS | fromODS() | ArrayBuffer |
Licence
This package is available under PolyForm Noncommercial, Small Business, or a 32-day Free Trial. Free Trial is local or internal evaluation only — it does not cover a public page. See what you can do under the trial.
Support
Questions and community help: Discord.
