Skip to main content

Quick Start (Vanilla)

Vanilla JavaScript

New Project

The fastest way to get started with SheetXL is using our project wizard. It will create a new project with SheetXL pre-configured and ready to use.

pnpm create sheetxl

...and follow the interactive prompts.

Existing Project

SheetXL Vanilla provides an easy way to embed powerful spreadsheet components into any web page.

This guide will get you started in about 1 minute.

The recommended approach uses our self-initializing embed script, which requires no JavaScript knowledge.


Installation

You can add SheetXL to your project either by using our CDN for a quick setup or by installing it from npm for use with a bundler like Vite or Webpack.

For traditional HTML pages, you can use the <script> tag to include SheetXL. This method is straightforward and requires no additional JavaScript or CSS setup.

The HTML

A <div> with an id and a <script>.

index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>SheetXL Demo</title>
</head>
<body>
<div id="sheetxl" style="height: 600px; width: 100%;"></div>
<script
src="https://unpkg.com/@sheetxl/studio-vanilla/cdn/loader.js"
data-target="#sheetxl"
data-license-key="YOUR_LICENSE_KEY_HERE"
defer>
</script>
</body>
</html>

Pass Configuration (Optional)

Pass any option to the workbook by adding it as a data-* attribute to the <script> tag.

  • Naming: Attributes are written in kebab-case (data-auto-focus) and are automatically converted to the camelCase props (autoFocus) your component expects.
  • Example: To enable autoFocus, add data-auto-focus="true".

This method gives you precise control over when and how the workbook is created using JavaScript. It's useful if you need to wait for other events or pass complex props programmatically.

That's it! Your workbook is ready.


API Documentation

Your journey doesn't stop here. The SheetXL object provides a rich API for creating and managing components.

Core API

  • initialize(options): An optional function to configure the library once, setting things like your licenseKey or custom dependency URLs.
  • attachStudio(options, props): Asynchronously creates and mounts a studio component, returning a promise that resolves to an instance controller with methods like .update() and .detach().
Full API Reference

This Quick Start guide only scratches the surface. For a complete list of all methods, see the full API documentation:

Example - CDN

Sometimes starting with an example is the simplest way to start.

The following code sandbox shows a single index.html page loading SheetXL from a CDN:

CodeSandbox-CDN

tip

Sandboxes can also be forked or downloaded to be run locally.