The API Copy or Create Workbook
QuickStart demonstrates how to manage Sigma workbooks programmatically using the REST API. It walks through creating new workbooks, intelligently copying existing ones, and managing sharing behavior—all while delivering a seamless user experience.
This sample implementation showcases how to:
My Documents
folderWhile this guide uses a specific design pattern, the approach is flexible—demonstrating how Sigma's API can be used to build custom workbook management workflows that meet the needs of your organization.
REST API Usage 01: Getting Started
For more information on Sigma's product release strategy, see Sigma product releases
If something doesn't work as expected, here's how to contact Sigma support
Developers who want to use Sigma's REST API to programmatically control Sigma in an embedded context.
Start the Express server in terminal from the embedding_qs_series_2_api_use_cases
folder and enable debugging:
DEBUG=true npm start
The server is ready when it displays: Server listening at http://localhost:3000
.
Browse to the landing page:
http://localhost:3000
Select the Copy or Create a New Workbook
page and click Go
.
Select the Embed_API_QuickStart
workbook:
When the page first loads, you'll see two list controls:
Click Create New Workbook
to open the modal.
Enter a name, then click Create Workbook
:
In this implementation, all newly created workbooks are saved to the user's My Documents
folder. However, you could easily modify the logic to allow selection other locations.
Once complete, you'll see a confirmation message, Workbook created successfully!
.
You can then find the workbook in Sigma under Recent:
By impersonating the build user, you'll also see the workbook under My Documents:
The newly created workbook (though still empty) is preloaded and appears in the My Documents
select list as well:
Once a workbook is created, the Copy Workbook
button becomes available.
There are many small design decisions behind the Create New Workbook
functionality. This example illustrates just one possible approach.
By leveraging the API, you can support a wide range of customized behaviors to fit your organization's needs.
Now that a workbook is loaded, you can click Copy Workbook
.
The user can provide a name for the new workbook or leave it blank. If left blank, the name defaults to the original workbook name with (copy) appended.
In this implementation, users can:
My Documents
folderTeam Workspace
they are a member ofThis behavior was defined at design time, but could be expanded to support other destinations:
After the copy is complete, a confirmation message appears, Workbook copied successfully!
.
The new workbook is then loaded for us.
When impersonating the build user in Sigma, we can confirm that:
Team Workspace
(if used) has the appropriate accessIn this example, we hardcoded the team permission to View
for simplicity.
This logic is found in the file: routes/api/workbook-copy-create.js
, in the following block:
// If this was a team workspace copy, share the workbook with the team
if (teamIdForSharing) {
if (DEBUG) console.log(`Sharing copied workbook with team: ${teamIdForSharing}`);
try {
const grantsUrl = `${process.env.BASE_URL}/workbooks/${data.workbookId}/grants`;
const grantsData = {
grants: [
{
grantee: {
teamId: teamIdForSharing
},
permission: 'view'
}
]
};
In this QuickStart, you learned how to use Sigma's REST API to create and copy workbooks programmatically. We covered:
This example demonstrates just one way to design a custom workbook management flow—providing a solid foundation you can extend to fit your specific use case.
Additional Resource Links
Blog
Community
Help Center
QuickStarts
Be sure to check out all the latest developments at Sigma's First Friday Feature page!