Sort Data Table Columns Alphabetically.

I would love to be able to sort columns in a data table alphabetically. IMO, this is kind of a no-brainer, especially when working with data tables that have hundreds of items. Now I’m sure that a lot of people would tell me to just export my data tables as CSV files, but that isn’t the most friendly nor convenient approach, nor could I do this in Excel. An example of what I might want to happen with sorting, is say I click on a column ‘Description’, it would sort all rows alphabetically based on the description column. This would make it easy to find blank descriptions, or anything really.

An issue that was brought up by someone:

Well, Enums could be sorted, Structs could as well, or simply disable that for Structs. It wouldn’t kill anyone to add some functionality before having 100% of what everyone wants. Simply sorting Strings and numbers would be a great start.

I’m gonna bump this for attention. It would be extremely useful to sort a data table by row name or a column.

exporting a simple text or number based to csv isnt very hard, and there are lots of csv editors that could probably reorganise things. But unless you’re starting from a CSV, its a bit of a pain. In my case, most of my data tables are references to in-editor classes and data assets, which makes exporting waaaayy more trouble than its worth.

1 Like

Regarding “nor could I do this in Excel” - you can do this type of sorting easily in Excel:

  1. Select top row with column headers
  2. Data >> Filter or Home >> Sort & Filter >> Filter – your column headers will now sort and filter
  3. Clean up your data using sorting and filtering features
  4. Export to CSV
  5. DataTable >> Re-import

Personally I use JSON instead of CSV for data storage. My typical workflow when I add new data table starts from blueprint struct and data-table based on it for prototyping purposes. Then I export my data table to JSON file with the same name and path as original data table. At this moment engine starts to prompt me if I want to reload my data table whenever JSON file changes. And so I’m free to use whatever external tool I want to use, as long as I dont’ forget to allow engine to reimport table from disk after external changes and don’t forget to re-export to JSON if I do changes using built-it editor for whatever reason. At some moment I usually switch to C++ struct instead of blueprint one, usually alongside with moving most of the code to C++ too but important thing is - no data is lost in process as data table for me is just a copy of real data from JSON.

While above could be doable with CSV as well, next part is main reason I prefer JSON over CSV:

Find, export and merge tools are used to process JSON files. Typical example is finding entries matching certain condition, exporting them to separate file, editing said file in UE4 as separate data table if in-editor references are used or externally if only simple data is to be edited and then merging them back to original file. Basically it means treating JSON files as sort of database. It requires some effort to setup once and may require custom-made tools (not sure if freely available tools for JSON processing are good enough as I already had them custom from long before going to UE4) but it’s well worth it in the long run.

Hello,
yes you can use Excel to export CSV’s, however, it should be rather easy and very convenient if they added permanent sorting support to modify data tables rows!
That point stays valid in my humble opinion and should be a TO DO for the staff at Epic.

How to modify Data Tables and Re-Import to Editor

  1. go to content browser, right click, export data table as CSV

  2. next to your exported CSV, on desktop, create a new EXCEL sheet.

  3. in EXCEL, go to Data /Import from Text or CSV, and choose your CSV sheet

  4. check the detected data selection, and if needed, adjust, should usually be fine;
    separation by comma.

HINT: I would suggest you do not use comma inside the cells as data in the head row;
Because it will be detected as cell separator falsly then easily, and generate empty columns. Happened to me.

  1. then modify your data table contents as needed in EXCEL, for example,
    in this case, click the top row top colum cell and select “sort from A to Z”.

  2. export as CSV from EXCEL

  3. open same exported CSV again in Google Office, Open Office or Notepad, and save again as CSV. I have tried 4 different Excel CSV formates, they will not be successfully imported to UNREAL.
    But Google Table CSV worked for me (simply open your CSV there online for free and download again!), and (link below) in another thread Open Office and Notepad had been confirmed by some Unreal Users. Apparently, Microsoft Excel does something to the basic structure of the CSV when saving that UE does not support on import.
    Trouble importing csv from Excel - #6 by JaredTherriault

  4. re-import a new Data Table.

HINT: you cannot import, as long as the file is opened in EXCEL, it seems write-protected,
so close EXCEL when importing to Unreal.
You import by right-click in your folder in content browser and “import to (path)”.

Simply select data table, and the original struct you used for the unmodified data table, assuming that your structure is still the same. Be careful that it still matches the underlying STRUCT of your Data Table.

Worked for me :slight_smile:
Cheers