Where do I programmatically create new roles? I want to programmatically create new roles in Drupal 8. I found this code in this post.

//your data array
$data = array('id' =&gt; 'client', 'label' =&gt; 'Client');
//creating your role
$role = \Drupal\user\Entity\Role::create($data);
//saving your role
$role-&gt;save();


But I don't know where I should put it, in which file, which folder? And how do I run it?
You have many place to create your roles, a simple way for you (As you says that you don't know nothing about Drupal) can be create a custom page (read the post) if you follow the example in the myPage() function you can go trough your list of roles and create each role in a loop, something like this;

public function myPage() {
...
  /* Read your roles
   * $my_roles[0]['id'] = 'client';
   * $my_roles[0]['label'] = 'My Client';
   */
  for ($i = 0; $i &lt; count($my_roles); $i++) {
    //your data array
    $data = array('id' =&gt; $my_roles[$i]['id'], 'label' =&gt; $my_roles[$i]['label']);
    //creating your role
    $role = \Drupal\user\Entity\Role::create($data);
    //saving your role
    $role-&gt;save();
  }
...
}


And if you go to your page you will create your roles.

EDIT: As Kevin says is better in other places like the hook_install()

Follow the steps to create a module and implement the hook_install() (Read at the end of the page how to do it)

Inside the hook implementation you will put the code:

/**
 * Implements hook_install().
 */
function YOUR_MODULE_install() {
    /* Read your roles
     * $my_roles[0]['id'] = 'client';
     * $my_roles[0]['label'] = 'My Client';
     */
    for ($i = 0; $i &lt; count($my_roles); $i++) {
      //your data array
      $data = array('id' =&gt; $my_roles[$i]['id'], 'label' =&gt; $my_roles[$i]['label']);
      //creating your role
      $role = \Drupal\user\Entity\Role::create($data);
      //saving your role
      $role-&gt;save();
    }
}


To create your roles you only need install your module.