axlsx icon indicating copy to clipboard operation
axlsx copied to clipboard

undefined method `downcase' when call the serialize method

Open marknguyen85 opened this issue 4 years ago • 2 comments

Hi there, I use the axlsx lib to write to xls file but got an error

api_1           | F, [2020-11-04T00:31:01.394784 #1] FATAL -- : [8f75aa98-0ecf-4285-952e-de661d02b51b]   
api_1           | F, [2020-11-04T00:31:01.394951 #1] FATAL -- : [8f75aa98-0ecf-4285-952e-de661d02b51b] NoMethodError (undefined method `downcase' for nil:NilClass):
api_1           | F, [2020-11-04T00:31:01.395017 #1] FATAL -- : [8f75aa98-0ecf-4285-952e-de661d02b51b]   
api_1           | F, [2020-11-04T00:31:01.395051 #1] FATAL -- : [8f75aa98-0ecf-4285-952e-de661d02b51b] (eval):3:in `map'
api_1           | [8f75aa98-0ecf-4285-952e-de661d02b51b] (eval):3:in `map'

Here is my environment:

Docker image: Ruby 2.5
Rails 5.2

Here is my code logic:

p = Axlsx::Package.new
wb = p.workbook
wb.add_worksheet(name: "Data") do |sheet|
     ....
end

dir_tmp = File.join(Rails.root, 'tmp')
FileUtils.mkdir_p(dir_tmp)
file_name_xls = "data.xlsx"
file_save_tmp = "#{dir_tmp}/#{file_name_xls}"

p.serialize(file_save_tmp) => got exception at this line

Plz help me fix it.

marknguyen85 avatar Nov 03 '20 17:11 marknguyen85

Does anyone help me?

marknguyen85 avatar Nov 08 '20 15:11 marknguyen85

Could you provide a complete backtrace?

noniq avatar Nov 08 '20 18:11 noniq