Hi,
You described your csv file into your first post here differently than the attached csv file !
Anyway, here is my go with it which is untested so please test it and let me know.
I am sure that you can learn from the following codes since you were able to come up with working method.
(defun c:Test ( / *error* csv opn ins str pos qty bkn )
;;------------------------------------------------------------;;
;; Author: Tharwat Al Choufi - Date: 19.Apr.2022 ;;
;; website: https://autolispprograms.wordpress.com ;;
;;------------------------------------------------------------;;
(defun *error* (msg)
(and opn (= (type opn) 'FILE) (close opn))
(princ "\n*Cancelled*")
)
(and (setq csv (getfiled "" (getvar 'dwgprefix) "csv" 16))
(setq opn (open csv "r"))
(setq ins '(5.0 0.0 0.0))
(or (while (setq str (read-line opn))
(and (setq pos (vl-string-search "," str 9))
(setq qty (atoi (substr str 1 (vl-string-search "," str))))
(tblsearch "BLOCK" (setq bkn (substr str 1 pos)))
(repeat qty
(command "_.-INSERT" bkn "_non" ins "1" "1" "0")
(setq ins (polar ins 0.0 5.0))
)
)
)
t
)
(setq opn (close opn))
)
(princ)
) (vl-load-com)