Skip to content

undefined method `downcase' when call the serialize method #657

@marknguyen85

Description

@marknguyen85

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions