The cm:export-to-csv command lets you export the following data into a CSV file using Contentstack CLI:
You can use this to perform tasks such as creating content backups, analyzing data, and more.
Note: Only the Organization Owner/Admin has the permissions to export an organization’s user or teams’ data.
Contentstack CLI lets you export content from the source stack to a CSV file by running the following command in your terminal:
csdx cm:export-to-csvThis command prompts the following options:
The CSV file gets generated in the following format:
<stack_name>_<content_type>_<language>_entries_exports.csv
You can also export entries to CSV using the Management Token alias.
Note: You must be logged in to the Contentstack app to export organization users.
When prompted, select the organization containing the user data you want to export. The CSV file is generated in the following format:
<orgName>_users_exports.csv
The CSV file is generated in the following format:
<org-name>_teams_export.csv
The CSV file is generated in the following format:
<org-name>_team_<team-uid>_User_Details_export.csv
The CSV file is generated in the following format:
<org-name>_team_User_Details_export.csv
The CSV file is generated in the following format:
stack_role_mapping_<team-uid>.csv
The CSV file is generated in the following format:
stack_role_mapping.csv
The CSV files are generated in the following formats:
<stack-name>_taxonomies.csv
<stack-name>_<taxonomy-name>_<taxonomy-uid>_terms.csv
Once you select any of the above options, a “data” folder is automatically created in your current working directory. The corresponding CSV files are stored within this folder.
Alternatively, you can provide the required parameters after the command in a single line as shown below:
csdx cm:export-to-csv -a <alias_of_management_token> -n <name_of_the_stack> --action <<entries_or_users_or_taxonomies>> --org <organization_UID> --org-name <name_of_the_organization> --locale <name_of_the_locale> --content-type <content_type_name> --delimiter <value>| Flag | Short Flag | Description |
|---|---|---|
| --action | - | Option to export data. Supported values: entries, users, teams, taxonomies |
| --alias | -a | Alias of the management token. |
| --org | - | Provide the organization UID to clone organization-level users. |
| --stack-name | -n | Name of the stack to be used in the CSV file name. |
| --stack-api-key | -k | API key of the source stack. |
| --org-name | - | Name of the organization to be used in the CSV file name. |
| --locale | - | Locale of the entries to be exported. |
| --content-type | - | Content type of the entries to be exported. |
| --branch | - | Name of the branch from which entries will be exported. |
| --team-uid | - | Provide the UID of a specific team in an organization. |
| --taxonomy-uid | - | Provide the taxonomy UID of the related terms you want to export. |
| --include-fallback | - | [Optional] Includes fallback locale data when exporting taxonomies. When enabled, if a taxonomy term does not exist in the specified locale, it falls back to the hierarchy defined in the branch settings. |
| --fallback-locale | - | [Optional] Specify a fallback locale for taxonomy export. This locale is used when a taxonomy term does not exist in the primary locale. Takes priority over branch fallback hierarchy when both are specified. |
| --delimiter | - | [Optional] Provide a delimiter to separate individual data fields within the CSV file. Default: , Example: cm:export-to-csv --delimiter ',' |
Examples:
csdx cm:export-to-csv --action <entries> --locale <locale> --alias <management-token-alias> --content-type <content-type> csdx cm:export-to-csv --action <entries> --locale <locale> --alias <management-token-alias> --content-type <content-type> --stack-name <stack-name> csdx cm:export-to-csv --action <users> --org <org-uid>csdx cm:export-to-csv --action <users> --org <org-uid> --org-name <org-name> csdx cm:export-to-csv --action <teams> --org <org-uid>csdx cm:export-to-csv --action <teams> --team-uid <team-uid>csdx cm:export-to-csv --action <teams> --org <org-uid> --org-name <org-name> --team-uid <team-uid>csdx cm:export-to-csv --action <taxonomies> --alias <management-token-alias> --taxonomy-uid <taxonomy-uid>csdx cm:export-to-csv --action <taxonomies> --alias <management-token-alias>csdx cm:export-to-csv --action <taxonomies> --alias <management-token-alias> --delimiter <delimiter>csdx cm:export-to-csv --action <entries> --locale <locale> --alias <management-token-alias> --content-type <content-type> --stack-name <stack-name> --branch <branch-name> csdx cm:export-to-csv --action <taxonomies> --alias <management-token-alias> --locale <locale> csdx cm:export-to-csv --action <taxonomies> --alias <management-token-alias> --locale <locale> --include-fallbackcsdx cm:export-to-csv --action <taxonomies> --alias <management-token-alias> --locale <locale> --include-fallback --fallback-locale <fallback-locale>