Jspreadsheet Client

The Jspreadsheet client extension provides a interface to connect on a remote jspreadsheet server to create collaborative spreadsheets. It requires Jspreadsheet Server running on your servers.

Documentation

Settings

Property Description
url: string The url point to the your Jspreadsheet Server.
path?: string The route for the API. Default: api/
token: string A valid signature to connect to the API and server.
onbeforesend?: Function Intercept all Ajax request headers.
onbeforesend(xhr: Object) => void
onbeforecreate?: Function Intercept the configuration before creating the spreadsheet.
(options: Object) => void
onbeforeload?: Function Intercept the URL.
(string: url) => string
onbeforeloadimage?: Function Before load an image.
onbeforeloadimage(worksheet: object, img: HTMLElement, options: object) => void | boolean

Installation

using NPM

$ npm install @jspreadsheet/client

using a CDN

<script src="https://cdn.jsdelivr.net/npm/@jspreadsheet/client/dist/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/socket.io@4.7.5/client-dist/socket.io.min.js"></script>

Example

Create an online spreadsheet from a remote configuration.

<html>
<script src="https://jspreadsheet.com/v11/jspreadsheet.js"></script>
<link rel="stylesheet" href="https://jspreadsheet.com/v11/jspreadsheet.css" type="text/css" />
<script src="https://jsuites.net/v5/jsuites.js"></script>
<link rel="stylesheet" href="https://jsuites.net/v5/jsuites.css" type="text/css" />
<script src="https://cdn.jsdelivr.net/npm/@jspreadsheet/client/dist/index.min.js"></script>

<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons" />

<div id="spreadsheet"></div>

<script>
// Set the license for both plugin and the spreadsheet
jspreadsheet.setLicense('OGQyODBiOWM2OGFlYmEwYWQ2ZTlkYTRiZDA2NjY1NzgwY2U1NzA5ZDFhMTViZjNlNmRkYzZlYTU4ZTFlNjllNWFlZWFkN2M0NmUzNmY3ZjA3Y2E0YjgyZjY2YWU0ODYwNWEyNWRhMDAxZmFkMjc4M2EzMjYwMzU2NTMxMmNmMjYsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpFek5Ea3dPVFl6TENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0ozWldJaUxDSnNiMk5oYkdodmMzUWlYU3dpY0d4aGJpSTZJak0wSWl3aWMyTnZjR1VpT2xzaWRqY2lMQ0oyT0NJc0luWTVJaXdpZGpFd0lpd2lkakV4SWl3aVkyaGhjblJ6SWl3aVptOXliWE1pTENKbWIzSnRkV3hoSWl3aWNHRnljMlZ5SWl3aWNtVnVaR1Z5SWl3aVkyOXRiV1Z1ZEhNaUxDSnBiWEJ2Y25SbGNpSXNJbUpoY2lJc0luWmhiR2xrWVhScGIyNXpJaXdpYzJWaGNtTm9JaXdpY0hKcGJuUWlMQ0p6YUdWbGRITWlMQ0pqYkdsbGJuUWlMQ0p6WlhKMlpYSWlMQ0p6YUdGd1pYTWlYU3dpWkdWdGJ5STZkSEoxWlgwPQ==');

// Set the extensions
jspreadsheet.setExtensions({ client });

// Connect
let remote = client.connect({
    url: 'https://jspreadsheet.com',
    path: 'server/',
    // Can be used to send extra information to the server to validate this user connection
    token: 'user-identifier-jwt'
});

// Create in case does not exist
remote.create('53aa4c90-791d-4a65-84a6-8ac25d6b1104', {
    tabs: true,
    toolbar: true,
    worksheets: [{
        minDimensions: [4,4]
    }]
});

// Connect to a spreadsheet
jspreadsheet(document.getElementById('spreadsheet'), {
    guid: '53aa4c90-791d-4a65-84a6-8ac25d6b1104'
});
</script>
</html>