Refactored the spreadsheet parse code.