---
title: "Dashboards - How to copy dashboards between users"
description: "Copying dashboards between users in OP5 Monitor requires removing the target user's existing dashboard first. A custom script helps automate copying and deleting dashboards after upgrading to version 7.2.6."
url: "https://docs.itrsgroup.com/docs/faq/op5/360020055974-op5-monitor-dashboards-how-to-copy-dashboards-between-users/index.html"
---
## INFO

ITRS does not officially support the below instructions but provides them as is.

In OP5 Monitor version 7.2.6, Sharable Dashboards were introduced. There is also a [how-to guide that features a Python script to clone multiple dashboards to another user](https://docs.itrsgroup.com/docs/faq/op5/360020054574-op5-monitor-how-to-clone-multiple-dashboards-to-another-user/index.html).

This how-to guide, however, goes more involved in what happens when you copy a dashboard from one user to another. We include here some extended features that also delete the target user's dashboard.

### Step-by-step guide

### Preconditions

1. Start with a preconfigured dashboard that will be propagated to users;
2. You need to remove the existing dashboard for the user before copying the new one. This must be done after the upgrade to 7.2.6, since the database layout has changed;
3. Make sure that none of the users to whom you will be propagating the dashboards are logged in;
4. Have a look at the database for dashboards:

**dash-copy.sql**

```
 # mysql merlin  mysql> select * from dashboards;  This will give you a long list of usernames with corresponding dashboards:  +----+-----------------------------------+--------------+--------+  | id | name | username | layout |  +----+-----------------------------------+--------------+--------+  | 1 | Dashboard for <user> | <user> | 1,3,2 |  | 2 | Dashboard for reports | reports | 3,2,1 |  | 3 | Dashboard for readonly | readonly | 3,2,1 |  [..]
```

### Steps

1. Save this information to a text file for later use.

   ID-Column

   Notice the column 'id', this is very important to have to be able to delete the user's dashboard from two tables: 'dashboards' and 'dashboard\_widgets'.

2. To remove the current dashboard for the user 'readonly', execute the following:

   **removing after copying**

   ```
   mysql> DELETE FROM dashboard_widgets WHERE dashboard_id = '3'; mysql> DELETE FROM dashboards where id = '3';
   ```

3. Repeat the procedure above for all users that should have a predefined dashboard.
4. Download the custom script that you can find at the bottom of this article in zip format (contains copy-dashboard.php). It has been developed for this process to your op5 server
5. Edit the script and change the parameters below, in this example I will copy the dashboard from the user '<user>' as the source user:

   ```
   // Name of the dashboard to copy to the users  $dashboard_name = 'Dashboard for <user>';  // Name of the user that owns (created) the dashboard  $dashboard_user = '<user>';
   ```

6. Use the aforementioned list of users that was saved from the database to insert into the array below:

   ```
   // List of usernames to copy the dashboard to,  // could be fetched from multiple locations  $target_users = array('reports, 'readonly');
   ```

7. Once you have double-checked the target and the source users, execute the script:

   ```
   # php copy-dashboard.php
   ```

8. Log into OP5 Monitor with one of the target users that were specified as a target in the script to verify.

## Related downloads

- [copy-dashboard.zip](/faq/downloads/op5/360020055974-360005669258-copy-dashboard.zip)


