Attempting to reference a DataTable in c++

I am having trouble referencing an already imported DataTable from an .csv file. I created the struct inheriting from FTableRowBase, and imported just fine. My problem currently is referencing that Data table in other parts of the code. What is currently failing is the construction of the FObjectFinder. What is the correct way to go about referencing this data table?

Here is my attempt so far:

UDataTable* ExcelTable;
ConstructorHelpers::FObjectFinder<UDataTable> ExcelTable_BP(TEXT("DataTable'/Game/DataTables/ExcelExample.ExcelExample'"));
ExcelTable = ExcelTable_BP.Object;

FExcelData* RowLookUp = ExcelTable->FindRow<FDGExcellData>(TEXT("Enemy1"), TEXT("LookUp Operation"));

if(RowLookUp)
{
//continue

I got a step further (didnt have the objectfinder function inside a constructor, woops)
Now the FindRow isnt retrieving the row. I tried debugging it and the rowstruct inside the ExcelTable is not defined apparently.

Never mind I solved it. For anyone else who stumbles upon this make sure the call to objectfinder is in an objects constructor (i believe this step is done when the editor is starting up, so you link it correctly). Then make sure when you import/reimport that you compile and run the editor again, it seems that the reference becomes invalidated when you reimport the Data Table.

But then you have to reconstruct everything that uses the data any time you re-import. The constructor is probably not going to be the best place to put his codeā€¦

Instead, you can use:

ConstructorHelpersInternal::FindOrLoadObject(Path)

To load it outside of the constructor.

Then you can bind to the FReimportManager::Instance()->OnPostReimport() delegate to dynamic reload the data, outside of the constructor, and refresh your in editor views whenever the table is reimported.

If you for some reason want the values in editor views then what you describe is probably possible (this is a very old post). However, what I did works perfectly fine during runtime of the actual game. Im not sure that something with ConstructorHelpers can be placed anywhere but the constructor unlike what you are claiming, but then again the engine might have changed since then and I have not looked at that stuff recently while my code still works. People that need to have the values refresh in editor views should try your method.