Trim spaces and account for single row or column