import Head from 'next/head'; import Link from "next/link"; import { readFile, utils } from 'xlsx'; import { join } from 'path'; import { cwd } from 'process'; export default function Index({snames, type}) { return (
SheetJS Next.JS {type} Demo

SheetJS Next.JS {type} Demo

This demo reads from /public/sheetjs.xlsx. Each worksheet maps to a path:

{snames.map((sname, idx) => (<> {`Sheet index=${idx} name="${sname}"`}

))}
); } export async function getStaticProps() { const wb = readFile(join(cwd(), "public", "sheetjs.xlsx")) return { props: { type: "getStaticPaths", snames: wb.SheetNames, }, } }