Further refactoring of the spreadsheet data retrieval code