# Conflicts when register several imports with the same extension

**URL:** <https://gramps.discourse.group/t/conflicts-when-register-several-imports-with-the-same-extension/6353>\
**Category:** Development\
**Tags:** gedcom7\
**Created:** [October 31, 2024, 11:44am UTC](https://gramps.discourse.group/t/conflicts-when-register-several-imports-with-the-same-extension/6353 "2024-10-31T11:44:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Urchello](https://avatars.discourse-cdn.com/v4/letter/u/c4cdca/32.png) [@Urchello](https://gramps.discourse.group/u/Urchello)\
**Post date:** [October 31, 2024, 11:44am UTC](https://gramps.discourse.group/t/conflicts-when-register-several-imports-with-the-same-extension/6353/1 "2024-10-31T11:44:35Z")

</div>

Im trying create some imports. They are registered successfully. But the problem is that always executes the first found xslx import. In current case this is **UA Birth Import**. I also tried select file type, but it doesnt help.

 ![image](https://global.discourse-cdn.com/free1/uploads/gramps/original/2X/b/befbc0931f6f8e75d35c7afecf9628cadc927eda.png)

I can not change types from xlsx to something like death.xslx, because then import openpyxl throws an exception. I also can not register extensions in a way like extension=‘death.xlsx’ because I receive another Gramps error that it doesnt have addons with xlsx extension.

```python
register(IMPORT,
         id='UABirthImport',
         name=_('UA Birth Import'),
         description=_('Imports Birth from xlsx files'),
         version='1.0.0',
         gramps_target_version='5.2',
         status=STABLE,
         fname='UABirthImport.py',
         import_function='import_data',
         extension='xlsx'
)

register(IMPORT,
         id='UAMarriageImport',
         name=_('UA Marriage Import'),
         description=_('Imports Marriage from xlsx files'),
         version='1.0.0',
         gramps_target_version='5.2',
         status=STABLE,
         fname='UAMarriageImport.py',
         import_function='import_data',
         extension='xlsx'
)

register(IMPORT,
         id='UADeathImport',
         name=_('UA Death Import'),
         description=_('Imports Death from xlsx files'),
         version='1.0.0',
         gramps_target_version='5.2',
         status=STABLE,
         fname='UADeathImport.py',
         import_function='import_data',
         extension='xlsx'
)

```

How can I use 3 separate imports? I beleave there is a valid way because multiple gramplets can use the same extension. But how deny to Gramps autodetecting? Or how would you do this?

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [October 31, 2024, 1:40pm UTC](https://gramps.discourse.group/t/conflicts-when-register-several-imports-with-the-same-extension/6353/2 "2024-10-31T13:40:42Z")

</div>

In the `import_function` for the [Gramps 5.3 registration for the built-in importer plug-ins](https://github.com/gramps-project/gramps/blob/master/gramps/plugins/importer/import.gpr.py), I see mostly `"importData"`. Your registrations have “import\_Data”

Harmonizing that is probably a starting point.

_Although there is one “impData” (for Gramps package) and one “\_importData” (for Pro-Gen)_

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [October 31, 2024, 1:45pm UTC](https://gramps.discourse.group/t/conflicts-when-register-several-imports-with-the-same-extension/6353/3 "2024-10-31T13:45:20Z")

</div>

I appreciate your question.

I am curious about the same thing for possibly [adapting the vCard importer](https://gramps.discourse.group/t/using-gramps-as-task-app/4022/19). (Gramps only supports the version 3 of vCard while my smart phone only exports the 2.1 version.)

It also seems like version support will be an issue when a GEDCOM7 import plug-in is developed.

---

<div class="post-metadata">

**Author:** ![Urchello](https://avatars.discourse-cdn.com/v4/letter/u/c4cdca/32.png) [@Urchello](https://gramps.discourse.group/u/Urchello)\
**Post date:** [October 31, 2024, 2:05pm UTC](https://gramps.discourse.group/t/conflicts-when-register-several-imports-with-the-same-extension/6353/4 "2024-10-31T14:05:10Z")

</div>

I solved my problem by removing two others registers

```python
register(IMPORT,
         id='UAImport',
         name=_('UA Import'),
         description=_('Imports from xlsx files'),
         version='1.0.0',
         gramps_target_version='5.2',
         status=STABLE,
         fname='UAImport.py',
         import_function='import_data',
         extension='xlsx'
)

```

Now I check import type inside import\_data

```python
def import_data(database, filename, user):
    try:
        workbook = openpyxl.load_workbook(filename)
        sheet = workbook["Main"]

        if "birth" in filename.lower():
            importer = UABirthImport(sheet)
            data = importer.process_data()
        elif "marriage" in filename.lower():
            importer = UAMarriageImport(sheet)
            data = importer.process_data()
        elif "death" in filename.lower():
            importer = UADeathImport(sheet)
            data = importer.process_data()
            pretty_print_data(data)
        else:

```

But what will happen when I will install another third-party addon with the same xlsx registered extension? which one import will trigger first? I dont understand.

---

<div class="post-metadata">

**Author:** ![Urchello](https://avatars.discourse-cdn.com/v4/letter/u/c4cdca/32.png) [@Urchello](https://gramps.discourse.group/u/Urchello)\
**Post date:** [October 31, 2024, 5:51pm UTC](https://gramps.discourse.group/t/conflicts-when-register-several-imports-with-the-same-extension/6353/5 "2024-10-31T17:51:41Z")

</div>

> [@emyoulation](#):
>
> Your registrations have “import\_Data”

I will check also in naming rules have some affect to the current problem, but looks like it doesnt matter. I’ll try, thank you for the answers!
