refactor excel code for space