The example below will open an empty space. To create the sheet your users
should land on, you’ll want to create a workbook as shown further down this
page.
Add a workbook configuration object. Read more about workbooks here.
Optionally deploy a listener for custom data processing. Your listener will contain your validations and transformations
You can also deploy and create your workbook via a server-side listener as
shown in the above link, rather than passing it in as a client-side property.
To reuse an existing space, you need to set up a server-side component that retrieves the space access token. The basic client-side approach shown above only works for initial space creation.For space reuse, you’ll need:
Server-side setup: Use your secret key to retrieve the space and its access token
Client-side update: Use the access token instead of just the publishable key
Copy
Ask AI
// Client-side: Get space data from your serverconst spaceData = await fetch("/api/spaces/us_sp_your_space_id").then((r) => r.json());// Use the space with access tokenwindow.FlatFileJavaScript.startFlatfile({ space: { id: spaceData.id, accessToken: spaceData.accessToken, // Retrieved from server },});
For complete server-side implementation, see Server Setup.