From: "Luca (Email)" Date: 2011-12-29T15:44:12+09:00 Subject: I: Simple CSV and Excel problem. -----Messaggio originale----- Da: cristian cristian [mailto:currambero@hotmail.com] Inviato: marted́ 27 dicembre 2011 22:15 A: ruby-talk ML Oggetto: Simple CSV and Excel problem. Hello all! Im a real newbie and I have been reading a lot of threads regarding csv and excel but still dont know how to solve my problem. I have a csv file like this: "title1","title2",.... "value1","value2",... "value11","value22",.. The problem: I would like to import this csv to an excel workbook. Later on work with the cells but thats another issue. Right now I would like to start with just import the csv. So in my mind the solution should be something like this: require 'win32ole' excel = WIN32OLE::new('excel.Application') excel.visible=1 wb = excel.Workbooks.Add() ws = wb.Worksheets(1) # Now an excel workbook is created and I would like to import the CSV. How? Is there a method or something that can be used? # I made this but dont know what to do for each iteration: def printCSV CSV.foreach(@filename,:headers => true, :quote_char => '"', :col_sep => ',', :row_sep =>:auto) do |row| "This code should write one value to each cell in the row of the worksheet "#puts row[0] end end Is this the best way of solving my problem? Any suggestions are appreciated! Br cristian -- Posted via http://www.ruby-forum.com/. -- Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f Sponsor: ING DIRECT Conto Arancio. 4,20% per 12 mesi, zero spese, aprilo in due minuti! Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid924&d)-12