15 lines
487 B
TypeScript
15 lines
487 B
TypeScript
|
|
import { parse } from "https://deno.land/std@0.211.0/csv/mod.ts";
|
|
|
|
async function readCsv(filepath: string) {
|
|
const fileContents = await Deno.readTextFile(filepath);
|
|
const result = await parse(fileContents, {
|
|
skipFirstRow: true, // set to false if you want to include the header
|
|
columns: ["pubkey", "balance", "updated_at"], // define the columns if needed
|
|
});
|
|
|
|
return result;
|
|
}
|
|
|
|
const filepath = "subscribers.csv";
|
|
readCsv(filepath).then((data) => console.log(data)); |