title: No such file or directory @ rb_sysopen, Working code as below in body
body: <pre><code>#!/usr/bin/env ruby
  require 'roo'
  require 'pathname'
  
  Dir.glob("**/*.xlsx") do |file|
   xlsx = Roo::Spreadsheet.open(file)
   bookname             = xlsx.column(1)
   chapter_number_array = xlsx.column(2).uniq
  
   chapter_number_array.each do |chapter|
     book_name      = bookname[1] if bookname
     chapter_number = chapter if (chapter_number_array &amp;&amp; (chapter != "Chapter"))
     Dir.mkdir(book_name) unless File.exists?(book_name)
     Dir.mkdir("#{book_name}/#{chapter_number}") unless File.exists?("#{book_name}/#{chapter_number}")
     xlsx.column(3).each do |md|
        book_chapter_path = Pathname.new("#{book_name}/#{chapter_number}")
        output_name = "#{book_chapter_path}/#{File.basename(md.partition('-').first, '.*')}.md" if (md != "Verse")
        output = File.open("#{output_name}", 'w')
        output &lt;&lt; "hello"
      end
    end
  end
  </code></pre>
  
  <h1><a href="https://drive.google.com/file/d/0B_-sckPdT2dlak9fbFZYVC1SVGs/view?usp=sharing" rel="nofollow noreferrer">.xlsx file_link_which_i_am_parsing</a></h1>
  
  <blockquote>
    <p>From link's file first column is directory 1, second column is 2 as child directory, third is again child directory and i am creating file of fourth column's first character(data is 1-3 then i am creating file as 1.md) in last child folder. I am putting file with any name folder where is my script available.</p>
  </blockquote>
  
  <h2>Output of "output_name" variable as below:</h2>
  
  <ul>
  <li>1 John/1/1.md    </li>
  <li>1 John/1/3.md</li>
  <li>1 John/1/5.md</li>
  <li>.............</li>
  <li>1 John/5/16.md</li>
  <li>1 John/5/18.md</li>
  <li>1 John/5/20.md</li>
  </ul>
  
  <h1>Getting error with "output" variable as below:</h1>
  
  <blockquote>
    <blockquote>
      <p>`initialize': No such file or directory @ rb_sysopen -  (Errno::ENOENT)</p>
    </blockquote>
    
    <p>I have searched on google but still not understading.</p>
  </blockquote>
  
  <h1>error as below:</h1>
  
  <blockquote>
    <p>./notes_to_markdown.rb:21:in <code>initialize': No such file or directory @ rb_sysopen -  (Errno::ENOENT)
        from ./notes_to_markdown.rb:21:in</code>open'
        from ./notes_to_markdown.rb:21:in <code>block (3 levels) in &lt;main&gt;'
        from ./notes_to_markdown.rb:18:in</code>each'
        from ./notes_to_markdown.rb:18:in <code>block (2 levels) in &lt;main&gt;'
        from ./notes_to_markdown.rb:11:in</code>each'
        from ./notes_to_markdown.rb:11:in <code>block in &lt;main&gt;'
        from ./notes_to_markdown.rb:5:in</code>glob'
        from ./notes_to_markdown.rb:5:in `'</p>
  </blockquote>
  
  <h1><a href="https://github.com/Bridgeconn/TN_TO_MD.git" rel="nofollow noreferrer">git_repository_for_script_file</a></h1>