Union based encoding of .csv file into a data table with different types
I don't have time to check all now but I found some things I want to share

If you are using C++17 consider using std::variant instead of the weak union inherited from c. It will probaly also solve youre isue with std::string. See: https://en.cppreference.com/w/cpp/utility/variant

Consider using '\n' instead of std::endl. Im pretty sure you only want a newline and not also a expensive flush of the buffer: https://stackoverflow.com/questions/213907/c-stdendl-vs-n.

Consider using the more safe enum class instead of plain c enum. It is available since C++11.