Angular spreadsheet

How to create an online spreadsheet with Angular and JSS.
// Install version 9
%npm install jspreadsheet-alpha

// Install version 8
%npm install jspreadsheet

// Install version 7
%npm install jspreadsheet-pro

Examples

Online spreadsheet with Angular

Online spreadsheet


Online XLSX editor with Angular

Angular XLSX editor



Source code

import { Component, ViewChild, ElementRef } from "@angular/core";
import * as jspreadsheet from "jspreadsheet";

@Component({
  selector: "app-root",
  templateUrl: "./app.component.html",
  styleUrls: ["./app.component.css"]
})
export class AppComponent {
  @ViewChild("spreadsheet") spreadsheet: ElementRef;

  ngAfterViewInit() {
    // License for Formula Plugin
    jspreadsheet.setLicense("your-license-here");
    // Create spreadsheet
    jspreadsheet(this.spreadsheet.nativeElement, {
      worksheets: [
        {
          data: [[]],
          minDimensions: [6, 4],
          columns: [
            {
              type: "dropdown",
              width: 100,
              source: ["Y", "N"]
            },
            {
              type: "color",
              width: 100,
              render: "square"
            }
          ]
        }
      ]
    });
  }
}

NOTE: Make sure to import the Jspreadsheet and Jsuites CSS files to your angular.json

"styles": [
    "styles.css",
    "jsuites/dist/jsuites.css",
    "jspreadsheet/dist/jspreadsheet.css"
],