code: def write_to_file
        File.open(outfile, 'w') do |out|
          out.puts header.to_s
          out.puts create_sum_row if @sum_row_pos == 'TOP'
          rows.each do |key, row|
            line = [] << row[:key]
            header.clear_header_cols.each_with_index do |col, index|
              next if index < row[:key].size
              line << row[:cols][col]
            end
            out.puts line.flatten.join(';')
          end
          out.puts create_sum_row if @sum_row_pos == 'EOF'
        end
      end
docs: Write table to _outfile_