Action that parses CSV data into structured JSON format Supports multiple input sources, custom delimiters, and various parsing options

Example

// Parse CSV with headers
await runAction({
ActionName: 'CSV Parser',
Params: [{
Name: 'CSVData',
Value: 'Name,Age,City\nJohn,30,NYC\nJane,25,LA'
}]
});

// Parse CSV from URL with custom delimiter
await runAction({
ActionName: 'CSV Parser',
Params: [{
Name: 'FileURL',
Value: 'https://example.com/data.csv'
}, {
Name: 'Delimiter',
Value: ';'
}]
});

// Parse CSV without headers
await runAction({
ActionName: 'CSV Parser',
Params: [{
Name: 'CSVData',
Value: 'John,30,NYC\nJane,25,LA'
}, {
Name: 'HasHeaders',
Value: false
}]
});

Hierarchy

  • BaseFileHandlerAction
    • CSVParserAction

Constructors

Methods

  • Parses CSV data into JSON format

    Parameters

    • params: RunActionParams<any>

      The action parameters containing:

      • CSVData: String containing CSV data (direct input)
      • FileID: UUID of MJ Storage file (alternative)
      • FileURL: URL of CSV file (alternative)
      • HasHeaders: Boolean indicating if first row contains headers (default: true)
      • Delimiter: Field delimiter character (default: ",")
      • QuoteChar: Character used to quote fields (default: '"')
      • EscapeChar: Character used to escape quotes (default: '"')
      • SkipEmptyRows: Skip empty rows (default: true)
      • TrimValues: Trim whitespace from values (default: true)
      • DynamicTyping: Convert numeric strings to numbers (default: true)
      • MaxRows: Maximum number of rows to parse (optional)

    Returns Promise<ActionResultSimple>

    Parsed CSV data as array of objects (if headers) or array of arrays

  • Executes the action with the provided parameters.

    Parameters

    • params: RunActionParams<any>

      The action execution parameters including context

    Returns Promise<ActionResultSimple>

    Promise resolving to the action result

  • Get file content from various sources based on parameters Priority: FileID > FileURL > Data parameter

    Parameters

    • params: RunActionParams<any>

      Action parameters

    • dataParamName: string

      Name of the parameter containing direct data

    • fileParamName: string = 'FileID'

      Name of the parameter containing file ID (default: 'FileID')

    • urlParamName: string = 'FileURL'

      Name of the parameter containing file URL (default: 'FileURL')

    Returns Promise<{
        content: string | Buffer;
        fileName?: string;
        mimeType?: string;
        source: "url" | "storage" | "direct";
    }>

    Object with content and metadata