@out = File.open(\"#{File.expand_path(\"CSV\")}/#{file_name}.csv\", \"w\") CSV::Writer.generate(@out) do |csv| csv << [\"01\", \"02\", \"test\"] end @out.clo
Change
CSV::Writer.generate(@out)do |csv|
to
CSV::Writer.generate(@out, {:force_quotes=>true}) do |csv|
So why not double quote them?
@out = File.open("#{File.expand_path("CSV")}/#{file_name}.csv", "w") CSV::Writer.generate(@out) do |csv| csv << ['"01"', '"02"', '"test"'] end @out.close