The TRIM function in Google Sheets is a nifty little tool that is especially useful for cleaning up those unnecessary spaces in your spreadsheets.
SYNTAX: =TRIM(text)
text - The string or reference to a cell containing a string to be trimmed.
Practice Sheet