write to excel implemented

couldn't test with the database. read comments