I found a problem with the following script from the Script Library.
It only works properly when the csv file has values in all of cells
in the last column. If there are some null values in the last column the

resultant block will be short one in each of those lines.
I have a kludge here.


foreach line next csv [append block parse/all line ","
   var1: to-string back tail block
   if var1 = "" [append block ""  ]
]


Bill


REBOL [
    Title:   "Comma-Seperated-Values to REBOL converter"
    Date:    16-Jun-1999
    Author:  "Bohdan Lechnowsky"
    Email:   [EMAIL PROTECTED]
    File:    %convert-csv.r
    Purpose: {
        Convert CSV files to REBOL blocks
    }
    Category: [file util text 2]
]

csv: read/lines to-file ask "Filename to convert from CSV: "

block: make block! 100
headings: parse/all first csv ","
;;;;;;;;;;;;;;

;;; line to change
foreach line next csv [append block parse/all line ","]
;;;;;;;;;;;;;;
save to-file ask "Filename to save to: " head insert/only block headings

Reply via email to