zdavatz / spreadsheet

The Ruby Spreadsheet by ywesee GmbH
http://spreadsheet.ch
GNU General Public License v3.0
1.13k stars 240 forks source link

xls format only writes number columns #191

Closed ctammes closed 7 years ago

ctammes commented 7 years ago

My script reads a xls file, modifies two columns and writes it back to disc. The file has 7 columns, two of which are numbers, the others text. When I view the result at the end of the process, the contents (sheet) are correct. However, after writing to disc, only the number columns are written, the text columns are blank. Any suggestions of how to solve this? Using gem version 1.14

Spreadsheet.client_encoding = 'UTF-8' book = Spreadsheet.open filename sheet=book.worksheet 0 sheet.each_with_index do |row, i| if i>0 row[5]= codes[i-1][0] row[6]= codes[i-1][1] end end out_file= filename.basename.to_s.gsub(/(.*)\.(.*)/,'\1_1.\2') book.write Rails.root.join(Rails.configuration.x.download_dir, out_file).to_s

zdavatz commented 7 years ago

send this to the mailinglist as well. https://groups.google.com/forum/#!forum/rubyspreadsheet

zdavatz commented 7 years ago

Please provide me with the source file and a full test-script to I can test this.