Rows n’ Columns Docs
Visit HomepagePricing
  • Introduction
  • License
  • Demos
  • Getting started
    • Installation
    • Spreadsheet state
    • Headless UI
    • Imperative Spreadsheet API
    • Examples
  • ⚙️Configuration
    • Features
      • Data validation
      • Formula evaluation
      • Real-time data
      • Cell editors
      • Cell renderer
      • Structured Cell Renderer
      • Theming
      • Styling
      • Context menu
      • Localisation
      • Undo/Redo
      • Conditional formatting
      • Named ranges
      • Structured references
        • Schema based tables and columns
        • Calculated columns
      • Basic filter or Excel AutoFilter
      • Charts
      • Embedded content
      • Calculate on-demand
      • Drag and Drop
      • Pivoting and Grouping (Coming soon)
      • Tokenizer
      • Lazy loading/Infinite scrolling
      • OpenAI/Chat GPT Integration
      • Search
      • Formula protection
      • Autofill
      • Export canvas as image
    • Components
      • Canvas Grid
      • Toolbar
      • Sheet Tabs
      • Sheet Switcher
      • Sheet Status
      • Range Selector
      • Formula Input
      • Selection Input
      • SheetSearch
      • NamedRangeEditor
      • DeleteSheetConfirmation
      • TableEditor
      • Cell Format Editor
      • Conditional Format Editor
      • Data Validation Editor
      • Insert Link Editor
      • Insert Image Editor
    • API
      • Cell Data
      • Sheets
      • SpreadsheetProvider
      • useSpreadsheet
      • Modules
      • SheetCell
    • Using Spreadsheet with NextJS
    • Keyboard shortcuts
  • Collaboration
    • Real time collaboration
    • Yjs Collaboration
    • Supabase realtime Collaboration
  • Charts
    • Charts
    • Custom charts
  • Excel and Google sheets
    • CSV
    • Excel
    • Google sheets (Coming soon)
  • Functions
    • Named functions
    • Array formulas
  • Data persistence
    • Server side data persistence
    • React Query integration
  • Specifications
    • Browser support
    • Third party licenses
  • Support
    • Contact support
    • Report bugs
    • Feature requests
Powered by GitBook
On this page
  • Generate personal access token
  • Login to Github
  • Install using Yarn or NPM
  • Render the Spreadsheet
  • Adding state
  • Adjusting the height of the Spreadsheet
  • Rending multiple spreadsheets
  • Customising colors and themes

Was this helpful?

  1. Getting started

Installation

Install Spreadsheet 2 using your preferred package manager.

PreviousDemosNextSpreadsheet state

Last updated 11 months ago

Was this helpful?

Spreadsheet 2 is hosted in github.com, hence you have to create a personal access token to install the npm package.

Generate personal access token

Visit to generate a personal access token

Login to Github

Enter your personal access token when prompted for password

npm login --scope=@rowsncolumns --registry=https://npm.pkg.github.com

You can also generate a new personal access token and add this to your .npmrc file

//npm.pkg.github.com/:_authToken=PERSONAL_ACCESS_TOKEN_FROM_https://github.com/settings/tokens
@rowsncolumns:registry=https://npm.pkg.github.com/

Install using Yarn or NPM

To install Spreadsheet 2 locally using a package manager, run one of these commands:

yarn add @rowsncolumns/spreadsheet
// Optional spreadsheet state hook
yarn add @rowsncolumns/spreadsheet-state
npm install @rowsncolumns/spreadsheet --save
// Optional spreadsheet state hook
npm install @rowsncolumns/spreadsheet-state --save

Render the Spreadsheet

The code below will render a stateless spreadsheet in your React application.

import React from 'react'
// Add css
import "@rowsncolumns/spreadsheet/dist/spreadsheet.min.css";
import { SpreadsheetProvider, CanvasGrid } from "@rowsncolumns/spreadsheet"

const MySpreadsheet = () => {
  const licenseKey = "will be emailed to you after purchase"
  return (
    <SpreadsheetProvider>
      <CanvasGrid licenseKey={licenseKey} />
    </SpreadsheetProvider>
  )
}

Adding state

Spreadsheet 2 does not manage any state internally, It is a controlled component.

Developers can pass Spreadsheet state as props and hook into callbacks and continue updating this state externally.

Adjusting the height of the Spreadsheet

The Spreadsheet automatically takes the height of the parent container.

// Auto-height
<div style={{ flex: 1}}>
    <Spreadsheet />
</div>

// Fixed height
<div style={{ height: 500 }}>
    <Spreadsheet />
</div>

Rending multiple spreadsheets

SpreadsheetProvider isolates Spreadsheet state to its own container. If you need multiple spreadsheets in a single page, wrap each spreadsheet with the provider

import "@rowsncolumns/spreadsheet/dist/spreadsheet.min.css";
import { SpreadsheetProvider, CanvasGrid } from "@rowsncolumns/spreadsheet"

const SpreadsheetA = () => {
  return (
    <SpreadsheetProvider>
      <CanvasGrid />
    </SpreadsheetProvider>
  )
}
const SpreadsheetB = () => {
  return (
    <SpreadsheetProvider>
      <CanvasGrid />
    </SpreadsheetProvider>
  )
}

const App = () => {
  return (
    <>
      <SpreadsheetA />
      <SpreadsheetB />
    </>
  )
}

Customising colors and themes

https://github.com/settings/tokens
Spreadsheet state
Headless UI
Theming