How to add copy paste capabilities to Select2 with AJAX data source?

Currently, I’m working on the Admin side of a Django 4.2 site.
The current version of Django, uses Select2 to handle FK fields in forms.

I have the need to add copy paste capabilities to those forms, so they can copy data from an excel and paste it and fill a collection of Select2s. But it seems that selecting the data from a remote sourced data it’s more tricky than expected.

According to the Select2’s documentation

For Select2 controls that receive their data from an AJAX source, using .val() will not work.

Instead, they recommend fetching the data yourself and adding it as a new option.

// Set up the Select2 control
$('#mySelect2').select2({
    ajax: {
        url: '/api/students'
    }
});

// Fetch the preselected item, and add to the control
var studentSelect = $('#mySelect2');
$.ajax({
    type: 'GET',
    url: '/api/students/s/' + studentId
}).then(function (data) {
    // create the option and append to Select2
    var option = new Option(data.full_name, data.id, true, true);
    studentSelect.append(option).trigger('change');

    // manually trigger the `select2:select` event
    studentSelect.trigger({
        type: 'select2:select',
        params: {
            data: data
        }
    });
});

Since the Select2 already knows how to fetch it’s own data, since it already does for the autocomplete, duplicating whats already implemented seems to me like a waste of time.

<select name="form-0-multiplex_index" id="id_form-0-multiplex_index" class="admin-autocomplete" data-ajax--cache="true" data-ajax--delay="250" data-ajax--type="GET" data-ajax--url="/admin/autocomplete/" data-app-label="sequencing" data-model-name="uploadedlibrary" data-field-name="multiplex_index" data-theme="admin-autocomplete" data-allow-clear="true" data-placeholder="" lang="en">

So, in a nutshell, my question is. How to programmatically search and select the first result on a Select2 input with Ajax fetched data given a string from the clipboard without having to re-implement it from scrath? (Or at the very least, reuse the parameters already present on the dom).