Data extract & write to CSV