JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 18
  • Score
    100M100P100Q26048F
  • License MIT

A TypeScript library for parsing unstructured Excel worksheets into cleaned and structured CSV files

Package Exports

  • sakti-parser-fa
  • sakti-parser-fa/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sakti-parser-fa) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

sakti-parser-fa

A TypeScript library for parsing unstructured Excel worksheets into cleaned and structured CSV files.

Installation

npm install sakti-parser-fa

Features

  • Parse Excel files (.xlsx) using ExcelJS
  • Convert Excel data to JSON or CSV format
  • Configurable output formatting options
  • TypeScript support with full type definitions
  • Zero security vulnerabilities

Quick Start

import { SaktiParser } from 'sakti-parser-fa';

// Create parser instance
const parser = new SaktiParser({
  outputFormat: 'csv',
  csvOptions: {
    header: true,
    delimiter: ','
  }
});

// Parse Excel file
const result = await parser.parseAndFormat('path/to/file.xlsx');
console.log(result.content); // CSV string

API Reference

SaktiParser

Constructor Options

interface ParserOptions {
  outputFormat?: 'object' | 'json' | 'csv'; // defaults to 'object'
  csvOptions?: {
    delimiter?: string;
    header?: boolean;
    quoted?: boolean;
  };
  jsonOptions?: {
    flat?: boolean; // defaults to true
  };
}

Methods

  • parse(filePath: string): Promise<ParseResult> - Parse Excel file and return structured data
  • parseAndFormat(filePath: string): Promise<OutputResult> - Parse and format in one step

Output Formats

Object Output (default)

Returns JavaScript object:

{
  metadata: ParsedMetadata,
  data: ParsedData[]
}

JSON Output

Returns object with metadata (object) and data (JSON string):

{
  metadata: ParsedMetadata, // JavaScript object
  content: string // JSON string of data array only
}

Example JSON content (stringified data):

[
  { "A": "value1", "B": "value2" },
  { "A": "value3", "B": "value4" }
]

CSV Output

Returns object with metadata (object) and data (CSV string):

{
  metadata: ParsedMetadata, // JavaScript object
  data: string // CSV string content
}

Requirements

  • Node.js >= 18.0.0

License

MIT