Skip to content

Export data to CSV

The /csvexport command allows you to export data of all users from your bot into a CSV file, based on the variables you specify. This feature is ideal for analyzing user information in a structured way or for creating customized reports.


How to use the command?

Export variable data

The /csvexport command generates a CSV file containing the specified variables in the desired format.

Basic format:

/csvexport variable1,variable2,variable3

Example:

/csvexport id,first_name,balance

This will export a CSV file with the id, first_name, and balance data of all the bot's users.


Sort data in the CSV

You can sort the CSV results in ascending or descending order using the --sort parameter.

  1. Descending order: Specify desc to sort the data from highest to lowest.

    Example: Export user data sorted by balance (from highest to lowest):

    /csvexport id,balance --sort=balance:desc
    
  2. Ascending order: Specify asc to sort the data from lowest to highest.

    Example: Export user data sorted by date_joined (from oldest to newest):

    /csvexport id,date_joined --sort=date_joined:asc
    

Exclusivity and limitations

  • Premium feature: This command is available exclusively to premium users. Check out the benefits of the premium subscription here.
  • Daily limit: A maximum of 3 exports per day is allowed. If you reach this limit, you will have to wait until the next day to make more exports.
  • Restricted access: Only the bot owner and administrators designated by the owner have permission to use this command. Regular users will not be able to execute it.

Important notes

  1. Choose the right variables: You can include any relevant variable in the command, whether private, global, or native, such as id, username, first_name, balance, date_joined, and more. More information about variables here.
  2. Sort complex data: Use the --sort parameter to organize your data as needed, either in ascending (asc) or descending (desc) order.
  3. Fast and easy export: Once the command is executed, the bot will generate and send you a CSV file ready for download and use in your analysis tools. The export can take from seconds to several minutes, depending on the number of users your bot has.

With the /csvexport command, you can access detailed information about your users in minutes, optimizing the management and analysis of your bot.