How to diffrentiate if the file is imported or not, I'm using gantt version 7.1.11 [React]

How to diffrentiate if the file is imported or not, I’m using gantt version 7.1.11.

Hello Genni,
For importing MSP or Excel files, need to use the importFromMSProject and importFromExcel functions. In the callback function, we check if there is the JSON data that you can use in the parse method. So, you can add the else closure and throw an error if there is no data from the server:

    data: file,
    callback: function (project) {
        if (project) {
            if (project.config.duration_unit) {
                gantt.config.duration_unit = project.config.duration_unit;
        else {
            const error_message = "No data from the export server";
            gantt.message({ type: "error", text: error_message });

To see how it works, you can try importing an MSP file in the following snippet, but instead of the import, you will get an error (because of a bug with the duplicate taskProperties):

If you mean something different, please describe your question in more detail.

I have created a column for serial number on the gantt chart, in this if the project is imported it should show external I’d coming from the project as serial number else it should increment the serial number. So, I’m unable to find a way to differentiate between imported and non-imported files in gantt.config.columns.

Hello Genni,
Thank you for the clarification.
If you already have a loaded data and want to differentiate it from the data of the imported file, you need to modify the imported data before loading it.
There, you need to add a specific property that will show that the data was imported.
Here is an example of how it can be implemented:

You can use a similar approach for the serial numbers.