title: Alternatives to add_row for axlsx
body: <p>In the following code, <code>happy_path</code> works, but not <code>sad_path</code>:</p>
  
  <pre><code>require "axlsx"
  
  def happy_path
    package = Axlsx::Package.new
    workbook = package.workbook
    worksheet = workbook.add_worksheet
    worksheet.add_row(["Hot", "Summer", "Night"])
    cell = worksheet.name_to_cell("A1")
    cell.value = "Cold"
    package.serialize("Happy_path_20130104.xlsx")
  end
  
  def sad_path
    package = Axlsx::Package.new
    workbook = package.workbook
    worksheet = workbook.add_worksheet
    worksheet.add_row(["Hot", "Summer", "Night"])
    cell = worksheet.name_to_cell("E1")
    begin
      cell.value = "Meatloaf"
    rescue NoMethodError
      STDERR.puts $!
    end
    package.serialize("Sad_path_20130104.xlsx")
  end
  
  happy_path
  sad_path
  </code></pre>
  
  <p><code>sad_path</code> gives the error </p>
  
  <pre><code>undefined method `value=' for nil:NilClass
  </code></pre>
  
  <p>because <code>cell</code> is nil.</p>
  
  <p><a href="http://rubydoc.info/github/randym/axlsx/Axlsx/Cell" rel="nofollow">http://rubydoc.info/github/randym/axlsx/Axlsx/Cell</a> and other parts of the documentation warn:</p>
  
  <blockquote>
    <p>Note: The recommended way to generate cells is via Worksheet#add_row</p>
  </blockquote>
  
  <p>The problem is that I want to be able to add data to A1, B1, and C1, and then later on add data to E1, F1 and G1.</p>
  
  <p>Is there any way of doing that? Or should I store the data for A1, B1, C1 and E1, F1 and G1, and add it to the worksheet all at once?</p>