📗
Excel-Builder-Vanilla
Live DemoGitHub
  • Introduction
  • Cookbook
    • Creating Workbooks
    • Creating Worksheets
    • Adding data to a Worksheet
    • Sizing/Hiding Columns
    • Setting row height/style
    • Fonts and Colors
    • Formatting numbers, dates, etc
    • Alignment
    • Background Fillers
    • Formulas
    • Tables
    • Theming Tables
    • Tables Summaries
    • Adding Headers and Footers to a Worksheet
    • Inserting images into spreadsheets
Powered by GitBook
On this page
  • Factory Style
  • Constructor Style
Edit on GitHub
  1. Cookbook

Creating Workbooks

Creating a workbook can be done one of two ways, depending on how you include the EB project.

Factory Style

import { createWorkbook } from 'excel-builder-vanilla';

const workbook = createWorkbook();

Constructor Style

import { Workbook } from 'excel-builder-vanilla';

const workbook = new Workbook();

This will eventually require you to include the 'excel-builder' module so you can export the workbook, so it's more verbose. However, this is also the best option for creating templates and the like.

Workbooks with no worksheet (i.e. data) will build, but Excel will throw an error while attempting to open it.

PreviousIntroductionNextCreating Worksheets

Last updated 1 year ago