; --- createCSV ----------------------------------------------------------------
(defun createCSV ( csvfile dblist delimit / file_w lines text record)
; function to create .csv file
; csvfile = path+filename to use. example: c:\\temp\\mydata.csv
; dblist = a 'database' list of values. (a list of lists)
; delimit = the delimiter to use. example: , ; \t (tab) etc.
; Example dblist: (("1" "x" "y")("2" "x" "y")("3" "x" "y"))
(setq file_w (open csvfile "w"))
(foreach record dblist
(setq i 0 text "")
(while (< i (length record))
(setq text (strcat text (nth i record))
i (1+ i)
)
(if (< i (length record))
(setq text (strcat text delimit))
)
)
(write-line text file_w)
)
(close file_w)
)
This function is what I use for creating .csv files.
Note: if you wish to export, edit data (with notepad or excel or ...) & write it back to acad entities (like block attributes) you need the entities handle for reference, just like dataextraction does.
For more info on that see: About Entity Handles and Their Uses (AutoLISP)
edit:
example of usage for createCSV:
(setq lst (list (list "1" "2" "3")(list "a" "b" "c")(list "A" "B" "C")))
(createCSV "c:/temp/testcsv.csv" lst "\t")
...and i bet you would like to have some lisp code to do the data extraction (?)