data2table function

Convert data to formatted data for table