A modern JavaScript library for vanilla spreadsheets

Overview

Spreadsheet.js

Landing page: https://spread-sheet.herokuapp.com/index.html

Documentation: https://spread-sheet.herokuapp.com/documentation.html

Getting started

Get started with Spreadsheet.js by including the source code file as a script in the head of your HTML page:

<script defer type="text/javascript" src="Spreadsheet.js"></script>

Spreadsheets are generated by selecting an empty <div> by its id with the Spreadsheet function, where the spreadsheet will be generated. Then, the createSpreadsheet method must be called on the selected element, passing in the spreadsheet configuration objects. Similarly, adding any optional styles to the spreadsheet requires calling the addCellStyle or addCellStyleSheet methods on the selected element.

It should be noted that the <div> container must be selected by the Spreadsheet function before creating the spreadsheet. Similarly, the spreadsheet must be created before adding any styling rules.

Initializing an existing empty <div> element as a spreadsheet

const mySpreadsheet = Spreadsheet('#myContainer');

Creating a spreadsheet, with options

The first object has keys that will represent the values in the spreadsheet's header row: there will be columns bank, cash ($), credit debt ($), investment portfolio ($), city, and date opened. Each key's respective value is the type of HTML input that that column's cells will accept. For instance, you will be only be able to input numbers into the cash ($) column and HTML dates under the date opened column.

This spreadsheet has all the possible option configurations in the second options object: a number (rowCount) to initialize the number of rows the spreadsheet will start with, a boolean (persistent) to indicate whether the spreadsheet will be saveable, a callback method (submitCallback) that is called with the spreadsheet's 2D array data as an argument when the Submit button is pressed, and a 2D array (data) to preload the spreadsheet's cell contents.

mySpreadsheet.createSpreadsheet(
  {
    bank: 'text',
    'cash ($)': 'number',
    'credit debt ($)': 'number',
    'investment portfolio ($)': 'number',
    city: 'text',
    'dated opened': 'date',
  },
  {
    rowCount: 4,
    persistent: true,
    submitCallback: (tableArray) => console.log(JSON.stringify(tableArray)),
    data: [
      ['TD', '10000', '1000000', '34535', 'Toronto', '2021-04-06'],
      ['RBC', '50000', '325345', '76868', 'Markham', '2020-06-22'],
      ['AmEx', '10000000', '5644', '76054', 'New York City', '2020-07-06']
    ]
  }
);

Adding a single styling rule

Here, cells with the value 10000 will be colored the HTML color green.

mySpreadsheet.addCellStyle('10000', 'green');

Adding a styling rule object for multiple styles

Here, cells with the value TD and RBC will have these hexcode colors respectively.

mySpreadsheet.addCellStyleSheet({ TD: '#64f547', RBC: '#5e87ff' });
You might also like...

A vanilla JavaScript library that automatically generates the "Table of Contents" of an HTML document.

DocumentOutline.js DocumentOutline is a vanilla JavaScript library that automatically generates the "Table of Contents" of an HTML document. See a liv

Jul 12, 2021

A very simple JavaScript library written in vanilla js for scrambling text.

A very simple JavaScript library written in vanilla js for scrambling text.

Scrambling Text A very simple JavaScript library written in vanilla js for scrambling text. Demo Page Table of Contents Installation Examples Basic Ex

Dec 7, 2022

A vanilla javascript library to generate Avataaars on the client or server side!

A vanilla javascript library to generate Avataaars on the client or server side!

Use the awesome Avataaars Library by Pablo Stanley (avataaars.com) in any javascript application. This Project uses parts of the Dicebear Avatars Libr

Dec 4, 2022

A vanilla JavaScript toast library

Vanilla Toasts (also refered to as vtoast) is a lightweight VanillaJS toast library. It does not require any framework to run. It is inspired from toa

Jan 18, 2022

🍦 ✨ Simple multi-select pure vanilla Javascript library.

🍦 ✨ Simple multi-select pure vanilla Javascript library.

multiSelect.js ✨ Simple multi-select pure vanilla Javascript library. 🚀 Live Demo v1.0.8 multiSelect.js is a simple, pure vanilla Javascript library

Mar 15, 2022

A simple easy to use vanilla JavaScript library for creating input fields that accept multiple email addresses

MeiMei - Multiple Email Input MeiMei: A simple easy to use vanilla JavaScript library for creating input fields that accept multiple email addresses.

Apr 13, 2022

A lightweight vanilla JavaScript context menu library with FontAwesome support.

A lightweight vanilla JavaScript context menu library with FontAwesome support.

Contextify A lightweight vanilla JavaScript context menu library with FontAwesome support. This library was written for use in a personal project of m

Jun 1, 2022

An authorization library that supports access control models like ACL, RBAC, ABAC in modern JavaScript platforms

An authorization library that supports access control models like ACL, RBAC, ABAC in modern JavaScript platforms

Casbin-Core đź’– Looking for an open-source identity and access management solution like Okta, Auth0, Keycloak ? Learn more about: Casdoor News: still w

Oct 20, 2022

Create HTML from CSS! A modern javascript library you'd expect Facebook to invent.

Create HTML from CSS! A modern javascript library you'd expect Facebook to invent.

Create HTML from CSS! A modern javascript library you'd expect Facebook to invent. Slowly build modern websites without ever leaving your CSS, with HeadwindHTML

Dec 30, 2022
Owner
Jason Hu
Seeking 2023 graduate positions. Computer Science @ UofT. Previously @ BlackBerry & OpenText.
Jason Hu
Websheetjs - Lightweight JS library to render website sections with data from Google Spreadsheets

websheet.js Render website sections with lazy-loaded data from Google Spreadsheets It's lightweight, fast, free and open-source ! See how it works, fu

Pierre Avinain 29 Oct 4, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Superlight vanilla javascript plugin, for modern web dropdowns. Supporting multi-options, search and images. Designed to be seamlessly themed

Superlight vanilla javascript dropdowns by LCweb Need to jump off of jQuery (or any other) dependency? Other packages are too heavy to just tweak sele

Luca 10 Dec 26, 2022
This is a vanilla Node.js rest API created to show that it is possible to create a rest API using only vanilla Node.js

This is a vanilla Node.js rest API created to show that it is possible to create a rest API using only vanilla Node.js. But in most cases, I would recommend you to use something like Express in a production project for productivity purposes.

Eduardo Dantas 7 Jul 19, 2022
A fast, vanilla JS customisable select box/text input plugin for modern browsers ⚡

choices A fast, vanilla, lightweight (~16kb gzipped ?? ), configurable select plugin for modern browsers. Similar to Select2 and Selectize but without

null 9 Aug 9, 2022
curtains.js is a lightweight vanilla WebGL javascript library that turns HTML DOM elements into interactive textured planes.

What is it ? Shaders are the new front-end web developpment big thing, with the ability to create very powerful 3D interactions and animations. A lot

Martin Laxenaire 1.4k Jan 1, 2023
Lightweight and simple notification library in Vanilla JavaScript.

SimpleNotification SimpleNotification is a library to display simple yet customizable notifications. You can stylize text with a simple syntax, add bu

null 14 Dec 11, 2022
A lightweight scrollbar library written in vanilla javascript.

A lightweight, dependency-free scrollbar library written in vanilla javascript. Fully customisable via CSS Native scrolling behaviour preserved Vertic

Karl 56 Dec 4, 2022