fix bug when spreadsheet does not have enough rows to insert