Namespaces

Version 11 of Jspreadsheet introduces the concept of namespaces, aimed at organizing multiple spreadsheet instances within the same context. With namespaces, calculations across spreadsheets are confined to those within the same namespace, allowing for identical worksheet names across different instances without affecting conflicting during cross-spreadsheet computations.

Documentation

This concept is very important when dealing with the jspreadsheet/server extension, since your server can manage hundreds of worksheets with the same name. The workspace should be unique, and if not defined JSS will generate a random GUID value for each new spreadsheet.

Settings

Shortcut Description
namespace: string Define the workspace scope of a spreadsheet. Default: random guid

Example

Cross calculations for multiple spreadsheets

In the following example, the second spreadsheet is configured to seamlessly reference data from an external worksheet, avoiding naming conflicts. Despite the last spreadsheet sharing the same worksheet name, it resides in a different namespace, preventing any interference with cross-spreadsheet calculations.

// Set your JSS license key (The following key only works for one day)
jspreadsheet.setLicense('Y2QxMDA1YWFiYTg0ZGU5MGRiYzYzYjA1ZDg5ZjY5Mjk2ZGI5OTE5ODg2YTkzNzhiMjkxZjMwZWQ5NmQ4MWRmMGJkMjNlNTk5NjFiZWE5ZmVmN2I3Njc2NjE3NzVlMWRlOGU4YzM4M2Y4ODI2MzcwZDZhN2FkZDU5ZWQwM2U2MDIsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpFME5EY3dNamN6TENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0ozWldJaUxDSnNiMk5oYkdodmMzUWlYU3dpY0d4aGJpSTZJak0wSWl3aWMyTnZjR1VpT2xzaWRqY2lMQ0oyT0NJc0luWTVJaXdpZGpFd0lpd2lkakV4SWl3aVkyaGhjblJ6SWl3aVptOXliWE1pTENKbWIzSnRkV3hoSWl3aWNHRnljMlZ5SWl3aWNtVnVaR1Z5SWl3aVkyOXRiV1Z1ZEhNaUxDSnBiWEJ2Y25SbGNpSXNJbUpoY2lJc0luWmhiR2xrWVhScGIyNXpJaXdpYzJWaGNtTm9JaXdpY0hKcGJuUWlMQ0p6YUdWbGRITWlMQ0pqYkdsbGJuUWlMQ0p6WlhKMlpYSWlMQ0p6YUdGd1pYTWlYU3dpWkdWdGJ5STZkSEoxWlgwPQ==');

// Create a new spreadsheet
jspreadsheet(document.getElementById('spreadsheet1'), {
    worksheets: [{
        data: [
            ['Mazda', 2001, 2000],
            ['Peugeot', 2010, 5000],
        ],
        worksheetName: 'Sheet1',
    }],
    namespace: 'c4b0065e-d777-4b9b-b89f-1c03c01ccf96',
});

// Create a second spreadsheet in the same workspace
jspreadsheet(document.getElementById('spreadsheet1'), {
    worksheets: [{
        data: [
            ['Total Tax', '=SUM(sheet1!c1, sheet1!c2)*0.2'],
        ],
        worksheetName: 'Sheet2',
    }],
    namespace: 'c4b0065e-d777-4b9b-b89f-1c03c01ccf96',
});

// Create a new spreadsheet in a different worspace
jspreadsheet(document.getElementById('spreadsheet1'), {
    worksheets: [
        {
            data: [
                ['Test', '=SUM(sheet2!a1)*0.2'],
            ],
            worksheetName: 'Sheet1',
        },
        {
            data: [
                [1,2,3],
            ],
            worksheetName: 'Sheet2',
        }
    ],
    namespace: 'c5551309-279c-4951-a948-9498dcc1d10b',
});