> ## Documentation Index
> Fetch the complete documentation index at: https://anaconda.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Code Snippets

Code Snippets enable you to securely upload reusable blocks of code to Anaconda.com. You can then share your snippets with other users, access your snippets in [Excel](https://anaconda.com/docs/legacy/excel/key-features.md), and insert your snippets across notebooks.

Anaconda maintains a Jupyter notebook that includes example code snippets you can modify and add to your own projects:

[Open in Anaconda Notebooks](https://anaconda.com/app/share/notebooks/df27d9ad-b174-4874-b5e2-698882754ea1/overview)

## Creating Code Snippets

Create a Code Snippet using the following steps:

1. Enter your code in an empty notebook cell.

2. Click  **Create a New Code Snippet** in the cell toolbar.

3. Enter a name for your code snippet.

4. Select a project to house your snippet.

   > [!NOTE]
   >
   > If you don't have any projects, a new project with the code snippet name as the title will be created.

5. Click **Create Code Snippet**.

A new `.py` file with the code snippet's name appears in the project and is ready to be used across your notebooks. Save the project by [pushing your project](https://anaconda.com/docs/anaconda-platform/notebooks/anaconda-toolbox/using-projects.md#syncing-projects-to-anacondas-cloud-storage) to Anaconda.com to share your snippets across devices and software.

## Sharing a snippet

You can share a snippet with others in your organization by [sharing the project](https://anaconda.com/docs/anaconda-platform/notebooks/anaconda-toolbox/using-projects.md#sharing-a-project) that contains the snippet.

## Inserting snippets in a notebook

When you're ready to use a saved snippet, insert it in a notebook using the following steps:

1. Open Anaconda Toolbox.
2. Under **Code Snippets**, select **Manage Code Snippets**. Alternatively, under **Projects**, select **Manage Projects**.
3. You can now insert your snippet in one of two ways:

   > [tab] Insert in cell
   >
   > 1. Select a cell in the notebook where you'd like to insert the code.
   > 2. Click  **Insert code snippet in notebook** beside the code snippet.
   >
   > The code snippet appears in a new cell below the selected cell. If no cell was selected, the code snippet appears in the last cell of the notebook.

   > [tab] Copy code
   >
   > 1. Click  actions beside the code snippet, then click  **Copy to Clipboard**.
   > 2. Select a cell in the notebook where you'd like to insert the code.
   > 3. Paste the code into the cell.

## Editing a snippet

To edit a snippet, you must make changes to the snippet directly in the Anaconda Toolbox extension.

1. Open Anaconda Toolbox.
2. Under **Code Snippets**, select **Manage Code Snippets**. Alternatively, under **Projects**, select **Manage Projects**.
3. Double-click the snippet's `.py` file to open the file.
4. Adjust your snippet.
5. To save your file changes, go to **File**, then select *Save Python File*.

You can now use your updated snippet across your notebooks. However, you'll need to [push the associated project](https://anaconda.com/docs/anaconda-platform/notebooks/anaconda-toolbox/using-projects.md#syncing-projects-to-anacondas-cloud-storage) to make the changes available in Anaconda.com.
