This is formula to use in Excel, So put your main data in Column A and put this formula in Column B and just copy and past value from column B — > Column A. When you paste Value each time it will remove Spaces.
Replace Space in excel
This has to go in Column B
'From Left Side
=IF(LEFT(A1,1) = " ",RIGHT(A1,LEN(A1)-1),A1)
From Right Side
=IF(RIGHT(A1,1) = " ",LEFT(A1,LEN(A1)-1),A1)