First working version that actually produces a correct spreadsheet.