How do I import data from Excel to getImageList?

Hi. Tell me, what are the options for importing data from Excel to getImageList?

getImageList is the snippet to output MIGX data to the front-end.

To import data for MIGX, there exists an action-button “importcsvmigx”.
In the MIGX configuration, go to the tab “Actionbuttons” and select the checkbox “importcsvmigx”.

Save you Excel data as a CSV (comma-separated values) file, so it can be imported.

Hello. In migx, I don’t see any configurations created.


The page template has

 [[!getImageList? 
                                &tvname=`price_category_2`
                                &tpl=`price_choise`
                                &docid=`[[*id]]`
                             ]]

TV price_category_2

You defined your MIGX TV directly in the TV (fields “Form Tabs” and “Grid Columns” in the tab “Input Options”).
I don’t think you can add the “Import”-Button this way.

Define the MIGX fields and columns by creating a new MIGX configuration (menu “Extras” → “MIGX”). Then in your TV, use the field “Configurations” to reference the created configuration (instead of using the fields “Form Tabs” and “Grid Columns”).

good afternoon. thanks

I’m trying to import some csv data into MIGX. There seems to be no tutorial, step by step on this, but I did finally find this topic. I think I’m pretty close but it’s not yet working.

I want to create a very simple glossary with just two fields, “Term” and “Definition”. I’ve created a configuration called “glossary” where I’ve set up the formtabs and columns. I’ve also added a action button called importcsvmigx. I’ve left all other fields blank.

I’ve created a MIGX tv where I’ve specified the “glossary” configuation in lieu of the formtabs and grid columns directly in the tv.

I’ve manually added a couple of terms and definitions on the resource where I’ve assigned the MIGX tv so I know the tv configuration is working. The import csv button is available and when I click on it I can navigate to the csv file.

The csv file has the field names in the first row of the file and two rows of data.

When I select the file and click OK. Nothing happens. I feel like I’m really close on this, but clearly missing something.

Any suggestions?

When I test it, there is an error ... fopen(glossary.csv): failed to open stream: No such file or directory in the MODX error log (and lots of subsequent errors).

It helps (in my case) when I change the import processor here

to add the MODX base path to the (relative) CSV file path:

$result = parse_csv_file(MODX_BASE_PATH . $pathname, $config);

Brilliant! That did the trick.

Thank you so much.

Is that something that needs to be patched?

It looks like the same code works correctly on MODX 2.x (but creates the error on MODX 3).

I have to take a closer look at the code to see why.
If I find a solution that works for both MODX 2 and 3, I will create a PR on Github.

That would be great. Thank you!

I created a pull request with a solution that is a bit different.

The quick fix I posted above only works, if the CSV file is selected in the default “Filesystem” media source.

Excellent! Thank you.

After this is implemented and I upgrade MIGX, will this will replace the “fix” you gave me earlier?