Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

zenmrp/FortuneSheetExcel

Repository files navigation

FortuneSheetExcel

FortuneSheetExcel is an Excel import library for FortuneSheet. It only supports .xlsx format files (not .xls).

It is a FortuneSheet port of Luckyexcel.

Features

Supports the following spreadsheet features:

  • Cell style
  • Cell border
  • Cell format, such as number format, date, percentage, etc.
  • Formula

Usage

import { transformExcelToFortune } from 'FortuneSheetExcel';

// e.g. got a file input change event
const xls = await e.target.files[0].arrayBuffer()
const fsh = await transformExcelToFortune(xls)
setData(fsh.sheets) // use this as the Workbook data

Interactively in a node repl:

f = await (await import("node:fs/promises")).readFile('/home/val/Downloads/Silkscreen.xlsx')
console.log((await (await import("FortuneSheetExcel")).FortuneExcel.transformExcelToFortune(f)).toJsonString())
// in dev: console.log((await (await import("./dist/main.js")).FortuneExcel.transformExcelToFortune(f)).toJsonString())

Authors and acknowledgment

License

MIT