# SQL worksheets Worksheets are the primary way to organize SQL work in [SQL Studio](../sql-studio/index.md). You can begin in a scratchpad, save a worksheet privately, or save it into a project when it is ready to share. ## Scratchpad The **scratchpad** is a private editor for one-off analysis. It is not saved as a Foundry resource and cannot be shared with other users. The scratchpad does not have version history. If its contents are replaced or overwritten, they cannot be restored. ## Save a worksheet Save SQL code as a worksheet when you want to preserve it beyond the scratchpad. You can save a worksheet in either of the following locations: * **Privately:** The worksheet is accessible only to you and appears in SQL Studio. * **In a project:** The worksheet becomes a Foundry resource in the selected project and can be shared with other users who have access to it. You can later save a private worksheet into a project when it is ready to share. Project worksheets can be opened from either SQL Studio or [Compass](../../compass/overview/index.md). You can also save a query from the embedded [SQL console](../sql-console/index.md) as a worksheet. ## Save and restore versions Each manual save creates a new worksheet version. You can open the worksheet's version history to inspect an earlier version or restore it. Between manual saves, SQL Studio automatically preserves unsaved changes so that in-progress work remains available between sessions. These changes do not create a version until you manually save the worksheet. ## Share and edit worksheets Access to a project worksheet depends on both the worksheet operations and the user's access to its project: * **Worksheet read** allows users to open and view a saved worksheet. * **Worksheet write** allows users to create, edit, and save worksheets. For the corresponding role operations, see [SQL permissions](../sql-permissions/index.md#relevant-operations). ## Publish an Ontology SQL function An [Ontology SQL function](../sql-functions/index.md) must be saved as a project worksheet before it can be published. Private worksheets cannot be published as Ontology SQL functions. ## Add worksheets to Marketplace products Project worksheets can be packaged into Marketplace products and installed in other projects. For details, see [Add SQL worksheets to a Marketplace product](../marketplace-sql-worksheets/index.md).