Name | Index |
---|---|
{p.Name} | {p.Index} |
--- title: Sheets in Svelte Sites sidebar_label: Svelte description: Build interactive websites with Svelte. Seamlessly integrate spreadsheets into your app using SheetJS. Bring Excel-powered workflows and data to the modern web. pagination_prev: demos/index pagination_next: demos/grid/index sidebar_position: 5 --- import current from '/version.js'; import CodeBlock from '@theme/CodeBlock'; [Svelte](https://svelte.dev/) is a JavaScript library for building user interfaces. [SheetJS](https://sheetjs.com) is a JavaScript library for reading and writing data from spreadsheets. This demo uses Svelte and SheetJS to process and generate spreadsheets. We'll explore how to load SheetJS in a Svelte component and compare common state models and data flow strategies. :::note pass This demo focuses on Svelte concepts. Other demos cover general deployments: - [Static Site Generation powered by SvelteKit](/docs/demos/static/svelte) - [iOS and Android applications powered by CapacitorJS](/docs/demos/mobile/capacitor) - [Desktop application powered by Wails](/docs/demos/desktop/wails) ::: ## Installation [The "Frameworks" section](/docs/getting-started/installation/frameworks) covers installation with Yarn and other package managers. The library can be imported directly from Svelte files with: ```js import { read, utils, writeFile } from 'xlsx'; ``` ## Internal State The various SheetJS APIs work with various data shapes. The preferred state depends on the application. ### Array of Objects Typically, some users will create a spreadsheet with source data that should be loaded into the site. This sheet will have known columns. For example, "Name" and "Index" are used in [`pres.xlsx`](https://docs.sheetjs.com/pres.xlsx):
Spreadsheet | State |
---|---|
![`pres.xlsx` data](pathname:///pres.png) | ```js [ { Name: "Bill Clinton", Index: 42 }, { Name: "GeorgeW Bush", Index: 43 }, { Name: "Barack Obama", Index: 44 }, { Name: "Donald Trump", Index: 45 }, { Name: "Joseph Biden", Index: 46 } ] ``` |
Name | Index |
---|---|
{p.Name} | {p.Index} |