ExcelJs - Want to read values as text
23:32 05 May 2025
import exceljs from "exceljs";
import { log } from "node:console";

const { Workbook } = exceljs;
const workbook = new Workbook();

const file = 'files/simpleNameValues.csv';
const worksheet = await workbook.csv.readFile(file);
worksheet.eachRow((row, rowNumber) => {
    log(row.values);
});

simpleNameValues.csv is

vessel_name,voyage_no
CMA CGM Mumbai,C2901R
OOCL Montreal,81E2

Problem: 81E2 gets displayed as 8100, as it is converting 81E2 to number 81 * 10^2. I have already tried modifying csv, to have 81E2 in double quotes, but it still gets converted to 8100. How can I instruct exceljs to interpret values as text only. Some google search wanted me parserOptions like below

const worksheet = await workbook.csv.readFile('files/simpleNameValues.csv', {
    parserOptions: {
      raw: true // Keep raw values
    }
  });

Still does not work.

exceljs fast-csv