As another said you may want a database especially since 6.1+ allows database lookup in a table.
With that said, here is an easy method.
Create an empty table of the name you want to create. Assign default if needed. Then a simple script
package require csv
set fd1 [open test.csv] ;# Open for read only. May need full path
set fd2 [open mytbl.tbl a+] ;# Open for append new table just created
# A list to check for duplicates. Assumes lookup is left to right
set dupList {}
# Read CSV file one record at a time
while {[gets $fd1 line] >= 0} {
# Just in case
if {[string trim $line] eq “”} { continue }
# Assumes two values in each csv record, adjust as required
lassign [csv::split $line] fld1 fld2
# Check for duplicates
if {[lsearch -exact $dupList $fld1] >= 0} {
echo $fld1 is duplicate in the record: $line — Ignorned!!
continue
}
# Put fld1 in list
lappend dupList $fld1
# Write to table. Assumes first csv value left, second right
puts $fd2 “#n$fld1n$fld2”
}
# close both
close $fd1
close $fd2
# You have to decide if it will be a left to right, right to left or both. Then you have to check for duplicates. The engine will puke on duplicates