Enviro+ all-in-one script with added csv writer

Hi

Has anyone any idea how to get the enviro+ readings to export to a csv file? I tried a but of code myself but it did not work. I am new to coding so any help would be great.