Good morning rishi

Assuming your data starts in A1, something like this is, say B1, and copied down would work :
=TRIM(A1)

HTH

DominicB