added new param in write to excel function