Autonumber
The native auto increment column type can be used as shown below.
|
---|
1 | 1 | DIVINELY UNINSPIRED TO A HELLISH EXTENT | LEWIS CAPALDI |
2 | 2 | NO 6 COLLABORATIONS PROJECT | ED SHEERAN |
3 | 3 | THE GREATEST SHOWMAN | MOTION PICTURE CAST RECORDING |
4 | 4 | WHEN WE ALL FALL ASLEEP WHERE DO WE GO | BILLIE EILISH |
5 | 5 | STAYING AT TAMARA'S | GEORGE EZRA |
6 | 6 | BOHEMIAN RHAPSODY - OST | QUEEN |
7 | 7 | THANK U NEXT | ARIANA GRANDE |
8 | 8 | WHAT A TIME TO BE ALIVE | TOM WALKER |
9 | 9 | A STAR IS BORN | MOTION PICTURE CAST RECORDING |
10 | 10 | YOU'RE IN MY HEART | ROD STEWART |
<html>
<script src="https://jspreadsheet.com/v10/jspreadsheet.js"></script>
<script src="https://jsuites.net/v5/jsuites.js"></script>
<link rel="stylesheet" href="https://jspreadsheet.com/v10/jspreadsheet.css" type="text/css" />
<link rel="stylesheet" href="https://jsuites.net/v5/jsuites.css" type="text/css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons" />
<div id="spreadsheet"></div>
<script>
jspreadsheet.setLicense('NjIxNDFmNWRmODZiNjI2MDNmMTIyMDE2ZWJhMzA2YjA0ZjA0ODI4MzExNzkzYjk0ODJkMTY5M2QzYzJkOWFiNDc2NDU4NmYwNGFjYzBhMzIxNDIwM2U3ZGU4Yjc0N2Q4MzA4ZTc0M2U1YTQ0OWVkNTk2NDU0Zjc4NDdlN2VhZWQsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpRek9URXdNemczTENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0ozWldJaUxDSnNiMk5oYkdodmMzUWlYU3dpY0d4aGJpSTZJak0wSWl3aWMyTnZjR1VpT2xzaWRqY2lMQ0oyT0NJc0luWTVJaXdpZGpFd0lpd2lkakV4SWl3aVkyaGhjblJ6SWl3aVptOXliWE1pTENKbWIzSnRkV3hoSWl3aWNHRnljMlZ5SWl3aWNtVnVaR1Z5SWl3aVkyOXRiV1Z1ZEhNaUxDSnBiWEJ2Y25SbGNpSXNJbUpoY2lJc0luWmhiR2xrWVhScGIyNXpJaXdpYzJWaGNtTm9JaXdpY0hKcGJuUWlMQ0p6YUdWbGRITWlMQ0pqYkdsbGJuUWlMQ0p6WlhKMlpYSWlMQ0p6YUdGd1pYTWlYU3dpWkdWdGJ5STZkSEoxWlgwPQ==');
jspreadsheet(document.getElementById('spreadsheet'), {
worksheets: [{
data: [
["1","DIVINELY UNINSPIRED TO A HELLISH EXTENT","LEWIS CAPALDI"],
["2","NO 6 COLLABORATIONS PROJECT","ED SHEERAN"],
["3","THE GREATEST SHOWMAN","MOTION PICTURE CAST RECORDING"],
["4","WHEN WE ALL FALL ASLEEP WHERE DO WE GO","BILLIE EILISH"],
["5","STAYING AT TAMARA'S","GEORGE EZRA"],
["6","BOHEMIAN RHAPSODY - OST","QUEEN"],
["7","THANK U NEXT","ARIANA GRANDE"],
["8","WHAT A TIME TO BE ALIVE","TOM WALKER"],
["9","A STAR IS BORN","MOTION PICTURE CAST RECORDING"],
["10","YOU'RE IN MY HEART","ROD STEWART"]
],
columns: [
{ type: 'autonumber', title: 'Id', readOnly: true, primaryKey: true, },
{ type: 'text', width: '350px', title: 'Title' },
{ type: 'text', width: '250px', title: 'Artist' }
]
}]
});
</script>
</html>
import React, { useRef } from "react";
import { Spreadsheet, Worksheet } from "@jspreadsheet/react";
const license = 'NjIxNDFmNWRmODZiNjI2MDNmMTIyMDE2ZWJhMzA2YjA0ZjA0ODI4MzExNzkzYjk0ODJkMTY5M2QzYzJkOWFiNDc2NDU4NmYwNGFjYzBhMzIxNDIwM2U3ZGU4Yjc0N2Q4MzA4ZTc0M2U1YTQ0OWVkNTk2NDU0Zjc4NDdlN2VhZWQsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpRek9URXdNemczTENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0ozWldJaUxDSnNiMk5oYkdodmMzUWlYU3dpY0d4aGJpSTZJak0wSWl3aWMyTnZjR1VpT2xzaWRqY2lMQ0oyT0NJc0luWTVJaXdpZGpFd0lpd2lkakV4SWl3aVkyaGhjblJ6SWl3aVptOXliWE1pTENKbWIzSnRkV3hoSWl3aWNHRnljMlZ5SWl3aWNtVnVaR1Z5SWl3aVkyOXRiV1Z1ZEhNaUxDSnBiWEJ2Y25SbGNpSXNJbUpoY2lJc0luWmhiR2xrWVhScGIyNXpJaXdpYzJWaGNtTm9JaXdpY0hKcGJuUWlMQ0p6YUdWbGRITWlMQ0pqYkdsbGJuUWlMQ0p6WlhKMlpYSWlMQ0p6YUdGd1pYTWlYU3dpWkdWdGJ5STZkSEoxWlgwPQ==';
export default function App() {
const spreadsheet = useRef();
const data = [
["1","DIVINELY UNINSPIRED TO A HELLISH EXTENT","LEWIS CAPALDI"],
["2","NO 6 COLLABORATIONS PROJECT","ED SHEERAN"],
["3","THE GREATEST SHOWMAN","MOTION PICTURE CAST RECORDING"],
["4","WHEN WE ALL FALL ASLEEP WHERE DO WE GO","BILLIE EILISH"],
["5","STAYING AT TAMARA'S","GEORGE EZRA"],
["6","BOHEMIAN RHAPSODY - OST","QUEEN"],
["7","THANK U NEXT","ARIANA GRANDE"],
["8","WHAT A TIME TO BE ALIVE","TOM WALKER"],
["9","A STAR IS BORN","MOTION PICTURE CAST RECORDING"],
["10","YOU'RE IN MY HEART","ROD STEWART"]
]
const columns = [
{ type: 'autonumber', title: 'Id', readOnly: true, primaryKey: true, },
{ type: 'text', width: '350px', title: 'Title' },
{ type: 'text', width: '250px', title: 'Artist' }
]
return (
<Spreadsheet ref={spreadsheet} license={license}>
<Worksheet data={data} columns={columns} />
</Spreadsheet>
);
}
<template>
<Spreadsheet ref="spreadsheet" :license="license">
<Worksheet :data="data" :columns="columns" />
</Spreadsheet>
</template>
<script>
import { Spreadsheet, Worksheet } from "@jspreadsheet/vue";
const license = 'NjIxNDFmNWRmODZiNjI2MDNmMTIyMDE2ZWJhMzA2YjA0ZjA0ODI4MzExNzkzYjk0ODJkMTY5M2QzYzJkOWFiNDc2NDU4NmYwNGFjYzBhMzIxNDIwM2U3ZGU4Yjc0N2Q4MzA4ZTc0M2U1YTQ0OWVkNTk2NDU0Zjc4NDdlN2VhZWQsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpRek9URXdNemczTENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0ozWldJaUxDSnNiMk5oYkdodmMzUWlYU3dpY0d4aGJpSTZJak0wSWl3aWMyTnZjR1VpT2xzaWRqY2lMQ0oyT0NJc0luWTVJaXdpZGpFd0lpd2lkakV4SWl3aVkyaGhjblJ6SWl3aVptOXliWE1pTENKbWIzSnRkV3hoSWl3aWNHRnljMlZ5SWl3aWNtVnVaR1Z5SWl3aVkyOXRiV1Z1ZEhNaUxDSnBiWEJ2Y25SbGNpSXNJbUpoY2lJc0luWmhiR2xrWVhScGIyNXpJaXdpYzJWaGNtTm9JaXdpY0hKcGJuUWlMQ0p6YUdWbGRITWlMQ0pqYkdsbGJuUWlMQ0p6WlhKMlpYSWlMQ0p6YUdGd1pYTWlYU3dpWkdWdGJ5STZkSEoxWlgwPQ==';
export default {
components: {
Spreadsheet,
Worksheet,
},
data() {
const data = [
["1","DIVINELY UNINSPIRED TO A HELLISH EXTENT","LEWIS CAPALDI"],
["2","NO 6 COLLABORATIONS PROJECT","ED SHEERAN"],
["3","THE GREATEST SHOWMAN","MOTION PICTURE CAST RECORDING"],
["4","WHEN WE ALL FALL ASLEEP WHERE DO WE GO","BILLIE EILISH"],
["5","STAYING AT TAMARA'S","GEORGE EZRA"],
["6","BOHEMIAN RHAPSODY - OST","QUEEN"],
["7","THANK U NEXT","ARIANA GRANDE"],
["8","WHAT A TIME TO BE ALIVE","TOM WALKER"],
["9","A STAR IS BORN","MOTION PICTURE CAST RECORDING"],
["10","YOU'RE IN MY HEART","ROD STEWART"]
]
const columns = [
{ type: 'autonumber', title: 'Id', readOnly: true, primaryKey: true, },
{ type: 'text', width: '350px', title: 'Title' },
{ type: 'text', width: '250px', title: 'Artist' }
]
return {
data,
columns,
license,
};
}
}
</script>
import { Component, ViewChild, ElementRef } from "@angular/core";
import jspreadsheet from "jspreadsheet";
import "jspreadsheet/dist/jspreadsheet.css"
import "jsuites/dist/jsuites.css"
jspreadsheet.setLicense('NjIxNDFmNWRmODZiNjI2MDNmMTIyMDE2ZWJhMzA2YjA0ZjA0ODI4MzExNzkzYjk0ODJkMTY5M2QzYzJkOWFiNDc2NDU4NmYwNGFjYzBhMzIxNDIwM2U3ZGU4Yjc0N2Q4MzA4ZTc0M2U1YTQ0OWVkNTk2NDU0Zjc4NDdlN2VhZWQsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpRek9URXdNemczTENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0ozWldJaUxDSnNiMk5oYkdodmMzUWlYU3dpY0d4aGJpSTZJak0wSWl3aWMyTnZjR1VpT2xzaWRqY2lMQ0oyT0NJc0luWTVJaXdpZGpFd0lpd2lkakV4SWl3aVkyaGhjblJ6SWl3aVptOXliWE1pTENKbWIzSnRkV3hoSWl3aWNHRnljMlZ5SWl3aWNtVnVaR1Z5SWl3aVkyOXRiV1Z1ZEhNaUxDSnBiWEJ2Y25SbGNpSXNJbUpoY2lJc0luWmhiR2xrWVhScGIyNXpJaXdpYzJWaGNtTm9JaXdpY0hKcGJuUWlMQ0p6YUdWbGRITWlMQ0pqYkdsbGJuUWlMQ0p6WlhKMlpYSWlMQ0p6YUdGd1pYTWlYU3dpWkdWdGJ5STZkSEoxWlgwPQ==');
@Component({
selector: "app-root",
template: `<div #spreadsheet></div>`,
})
export class AppComponent {
@ViewChild("spreadsheet") spreadsheet: ElementRef;
worksheets: jspreadsheet.worksheetInstance[];
ngAfterViewInit() {
this.worksheets = jspreadsheet(this.spreadsheet.nativeElement, {
worksheets: [{
data: [
["1","DIVINELY UNINSPIRED TO A HELLISH EXTENT","LEWIS CAPALDI"],
["2","NO 6 COLLABORATIONS PROJECT","ED SHEERAN"],
["3","THE GREATEST SHOWMAN","MOTION PICTURE CAST RECORDING"],
["4","WHEN WE ALL FALL ASLEEP WHERE DO WE GO","BILLIE EILISH"],
["5","STAYING AT TAMARA'S","GEORGE EZRA"],
["6","BOHEMIAN RHAPSODY - OST","QUEEN"],
["7","THANK U NEXT","ARIANA GRANDE"],
["8","WHAT A TIME TO BE ALIVE","TOM WALKER"],
["9","A STAR IS BORN","MOTION PICTURE CAST RECORDING"],
["10","YOU'RE IN MY HEART","ROD STEWART"]
],
columns: [
{ type: 'autonumber', title: 'Id', readOnly: true, primaryKey: true, },
{ type: 'text', width: '350px', title: 'Title' },
{ type: 'text', width: '250px', title: 'Artist' }
]
}]
});
}
}