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

SheetJS Next.JS {type} Demo

This demo reads from /public/sheetjs.xlsx and generates HTML from the first sheet.
); } export async function getStaticProps() { const wb = readFile(join(cwd(), "public", "sheetjs.xlsx")) return { props: { type: "getStaticProps", html: utils.sheet_to_html(wb.Sheets[wb.SheetNames[0]]), }, } }