> For the complete documentation index, see [llms.txt](https://docs.digit.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digit.org/naljalseva/setup-naljalseva/setup-naljalseva/create-new-tenant.md).

# Create New Tenant

This documentation outlines the process of setting up a new tenant in MDMS (Master Data Management System). To achieve this, it involves cloning the MDMS repository locally and utilizing a Python script that interacts with an Excel file containing essential information for the new tenant setup.

## Pre-requisites <a href="#pre-requisites" id="pre-requisites"></a>

1. Clone the [MDMS](https://github.com/misdwss/mdms-mgramseva) repository to your local machine.
2. Have the Excel file ready for reference. The structure of the Excel file is critical, and any changes must align with the specified columns. The reference to the Excel file is given below.

## Steps <a href="#steps" id="steps"></a>

#### Python Script Configuration <a href="#python-script-configuration" id="python-script-configuration"></a>

1. Locate the Python script for adding a new tenant. The script can either be placed in the "tenants" folder locally or specify the full path where your "tenants.json" folder is present within the script.
2. Open the script and edit the following lines to match your requirements:

   ```
   dataframe = openpyxl.load_workbook("Book2.xlsx")
   ```

   Replace "Book2.xlsx" with the name of your Excel file containing tenant information.
3. Specify the sheet name in your Excel file where the required data is stored.

   ```
   dataframe1 = dataframe["Sheet1"]
   ```

#### Excel File Preparation <a href="#excel-file-preparation" id="excel-file-preparation"></a>

1. Ensure your Excel file adheres to the specified format. The columns must match the template provided, and any deviation may result in script failure.
2. Do not modify the column structure in the Excel sheet, as the script relies on a consistent format.

#### Running the Script <a href="#running-the-script" id="running-the-script"></a>

Execute the Python script after configuring it according to your needs. The script will process the Excel file, and upon completion, a new file named "tenants\_new\.json" will be generated.

**Deploying to MDMS**

* Copy the generated `tenants_new.json` file to the MDMS repository or select and apply the updated data within MDMS as needed.

[5KBBook2.xlsx](https://3004460086-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQx3WcyfCEvIVnLyuvkbo%2Fuploads%2FP1nc2ME7YviW3yxQkbxL%2FBook2.xlsx?alt=media\&token=b762f4bd-b1ce-45e5-85d8-2409a695d71b)

[3KBcreate\_tenants\_json\_Book2.py](https://3004460086-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQx3WcyfCEvIVnLyuvkbo%2Fuploads%2FW9hI7J58OsEixawW743M%2Fcreate_tenants_json_Book2.py?alt=media\&token=3f9be32c-6ffa-40d3-9801-d3a7d2a671ff)

After creating a tenant in the tenants.json file we need to make a separate folder in MDMS for each tenant.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digit.org/naljalseva/setup-naljalseva/setup-naljalseva/create-new-tenant.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
