# CSV Import

Rather than manually add shortcodes to your [shortcode collection](https://yeken.gitbook.io/snippet-shortcodes/features/own-shortcodes), Snippet Shortcodes has a CSV import tool which allows you to bulk import shortcodes.

**Note:** Depending on your server, you may need to split larger CSV files into smaller, more manageable sizes for performance reasons. As a guide, we'd recommend processing no more than 500 rows at a time.

#### CSV Format <a href="#csv-format" id="csv-format"></a>

A CSV file must adhere to the following rules:

* Have a header row with the following headers:

```
slug,content,global,enabled
```

*Note: The column "content" is required however, the data for each row can be left blank if not required.*

* Have one or more data rows.
* For each row, ensure the following are met:
  * Has a "slug" that is 100 characters or less.
  * Ideally have a value for "content" - otherwise you're importing a blank column.
  * A value of "yes", "no", "true" or "false" for "global".
  * A value of "yes", "no", "true" or "false" for "enabled".

**Note:** If the import finds the above rules haven't been met, then the row will either be skipped or fail.

**A simple CSV example**

```
slug,content,global,enabled
business-development,Robust background support,false,false
human-resources,Stand-alone regional encoding,false,true
legal,Automated needs-based utilisation,false,false
support,Our support team is located in Canada,false,false
...
```

Below is a sample CSV with 40 shortcodes:

{% file src="<https://3958622721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7uAQEFKsxwRu8q5XW3xQ%2Fuploads%2FbQNWGthWBoNiNZMJtnWq%2Fcsv-import-test.csv?alt=media&token=ee906706-6e31-43cc-9db5-bf1908b1fb4e>" %}

Importing a CSV file

* Via the WordPress Admin menu, navigate to "Snippet Shortcodes" > "Import Shortcodes".
* Using the button labelled "Select CSV", choose a CSV file already uploaded into your Media Library or upload a new one from your computer.
* Examine the output report and action any errors.

**Dry run mode**

If selected, dry run mode will run basic tests against each row without attempting to update the database. We recommend you do this before performing an import as it gives the opportunity to correct any issues before attempting the main import.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yeken.gitbook.io/snippet-shortcodes/features/csv-import.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
