Products

Spreadsheet Sharing

Intrasheets offers a spreadsheet feature that allows users to share their spreadsheets by link or through an embed option. This feature provides flexible access control, enabling developers to define specific authentication rules and permissions based on ownership, privacy, invitation status or any other custom methods.

Sharing via link

With Intrasheets, developers can implement custom authentication checks to control user access to shared spreadsheets. For example, when a user requests a spreadsheet link, the server can verify ownership or confirm if the user has an invitation. Based on these settings, users can view public spreadsheets or gain access to private ones through a secure invitation link.

Inviting a new user

Intrasheets provides a built-in interface for creating user invitations. The application generates new invitation token when adding a new user. New users can be added through the interface or via the API extension if enabled.

1. Invitation Token

The invitation token is a unique hash appended to a spreadsheet URL, enabling the server to verify user permissions and manage access based on server-defined rules. For more information about that, please check more about the authentication methods.

Example: https://yourdomain.com/sheets/4b8bd2c1-f3c4-4c36-b4ec-e5e3fb15f1e7/27aff468

2. Token persistence

The token is normally available within the spreadsheet object, typically structured as:

{
    spreadsheet: {}
    users: [
        {
            email: 'test@test.com',
            level: 0, // 0 as reader, 1 as editor, 2 as owner
            token: '27aff468'
        }
    ]
}

Custom Email Notifications

Users can use the “Send an email notification” option when sharing a spreadsheet using the share interface. Developers can intercept this action using the beforeChange event on the server side, giving them control over how and when email notifications are sent to users.

server({
    // Other events (...)
    beforeChange: async function(guid, changes, auth) {
        // Before the user changes the spreadsheet
        let test = await Authentication('change', guid, auth);
        if (test) {
            // Verify if the method requires ownership
            if (requireOwnership(changes.method)) {
                // Requires ownership
                let level = await getUserLevel(guid, auth);
                // User is owner
                if (level === 2) {
                    // For the users check if you need to send email
                    if (changes.method === 'setUsers') {
                        // Interface is flagged to send email
                        let sendmail = changes.args[1];
                        if (sendmail) {
                            let users = changes.args[0];
                            if (users && users.length) {
                                // Send the invitation by email
                                console.log(users)
                            }
                        }
                    }
                } else {
                    // The user does not have permission
                    return false;
                }
            }
        }
        return test;
    }
    // Other properties (...)
})

Embed Spreadsheets

For public spreadsheets is possible to generate a snippet code for sharing a spreadsheet in any website. This code can be generated using the Intrasheets application.

Formifier

Sample code

Users can generate a snipped code as below from the Intrasheets interface.

<div id="spreadsheet"></div>
<script src="https://cdn.jsdelivr.net/npm/@jspreadsheet/cloudify/dist/index.min.js"></script>
<script>
// Create a Jspreadsheet Cloud spreadsheet
cloudify(document.getElementById('spreadsheet'), {
    url: 'https://yourddomain.com/api',
    guid: '1766f0e3-f898-47d8-8e34-f8efaee471ff',
    license: 'your-license',
});
</script>