Skip to main content
Module

std/csv/parse.ts>parse

Deno standard library
Go to Latest
function parse
import { parse } from "https://deno.land/std@0.218.2/csv/parse.ts";

Csv parse helper to manipulate data. Provides an auto/custom mapper for columns.

Examples

Example 1

import { parse } from "https://deno.land/std@0.218.2/csv/parse.ts";
const string = "a,b,c\nd,e,f";

console.log(
  await parse(string, {
    skipFirstRow: false,
  }),
);
// output:
// [["a", "b", "c"], ["d", "e", "f"]]

Parameters

input: string

Input to parse.

optional
opt: undefined

options of the parser.

Returns

string[][]

If you don't provide opt.skipFirstRow and opt.columns, it returns string[][]. If you provide opt.skipFirstRow or opt.columns, it returns Record<string, unknown>[].

Csv parse helper to manipulate data. Provides an auto/custom mapper for columns.

Examples

Example 1

import { parse } from "https://deno.land/std@0.218.2/csv/parse.ts";
const string = "a,b,c\nd,e,f";

console.log(
  await parse(string, {
    skipFirstRow: false,
  }),
);
// output:
// [["a", "b", "c"], ["d", "e", "f"]]

Parameters

input: string

Input to parse.

opt: T

options of the parser.

Returns

If you don't provide opt.skipFirstRow and opt.columns, it returns string[][]. If you provide opt.skipFirstRow or opt.columns, it returns Record<string, unknown>[].