format structure and add convert to csv