Was this article helpful?
Thanks for your feedback
The cm:export-to-csv command allows users to export the following data into a CSV file:
This makes it easy for users to perform other operations such as create content backups, perform data analysis, and so on.
To export the content of a stack, you need to have access to it. Likewise, to export an organization’s user data, you need to be the “owner” or an “admin” user of that organization.
You can export content into a .csv file by performing the following two steps:
Note: By default, the CLI session uses the North America region. To set the Europe or Azure North Amercia region, refer to the Set Region command for more details.
You will need an authtoken to use the export-to-csv command. To generate the authtoken, open your terminal, and run the following command to log in to your Contentstack account:
csdx auth:login
It will ask you to provide your email address and password of your Contentstack account. Once you log in successfully, an authtoken will be generated and saved to the CLI session until you log out from this session.
Additional Resource: To learn more about the login command, refer to the Login command section.
Now that you are logged in to Contentstack, let’s export content from the source stack in a CSV file by running the following command in your terminal:
csdx cm:export-to-csv
This command will prompt the following options as follows:
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.
Once you select any one of the above-mentioned options, the “data” folder is auto-generated in the current working directory (folder), and the corresponding CSV files are stored within this “data” folder.
The alternate way of using the command is by providing 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>> --org <organization_UID> --org-name <name_of_the_organization> --locale <name_of_the_locale> --content-type <content_type_name>
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>
Was this article helpful?
Thanks for your feedback