Here is an old one I have that I think will do what you want. Not sure though, as I haven't used it in awhile.
(defun c:ExportTextTable (/ tempPt XValList PtValList tempList tempStr EndList XValCnt StrCnt MaxCnt StrList Opened *error*)
(defun *error* (msg)
(if Opened (close Opened))
(if msg (prompt (strcat "\n Error-> " msg)))
)
;--------------------------------------------------------------
(if (ssget '((0 . "TEXT")))
(vlax-for obj (vla-get-ActiveSelectionSet (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(setq tempPt
(vlax-get
obj
(if (equal (vla-get-Alignment obj) 0)
'InsertionPoint
'TextAlignmentPoint
)
)
)
(if (not (vl-position T (mapcar '(lambda (x) (equal (car tempPt) x 0.00001)) XValList)))
(setq XValList (cons (car tempPt) XValList))
)
(setq PtValList
(cons
(cons
(vl-string-translate "," ";" (vla-get-TextString obj))
tempPt
)
PtValList
)
)
)
)
(foreach lst PtValList
(if (setq tempList (assoc (setq tempStr (rtos (caddr lst) 2 10)) EndList))
(setq EndList
(subst
(list
tempStr
(cons lst (cadr tempList))
)
tempList
EndList
)
)
(setq EndList (cons (list tempStr (list lst)) EndList))
)
)
(if EndList
(progn
(setq EndList
(vl-sort
EndList
'(lambda (a b)
(> (distof (car a)) (distof (car b)))
)
)
)
(setq XValList (vl-sort XValList '<))
(foreach lst EndList
(setq lst
(vl-sort
(cadr lst)
'(lambda (a b)
(< (cadr a) (cadr b))
)
)
)
(setq XValCnt 0)
(setq StrCnt 0)
(setq MaxCnt (length XValList))
(setq tempStr "")
(repeat (length lst)
(while (not (equal (cadr (nth StrCnt lst)) (nth XValCnt XValList) 0.0000001))
(setq tempStr (strcat tempStr ","))
(setq XValCnt (1+ XValCnt))
)
(setq tempStr (strcat tempStr (car (nth StrCnt lst))))
(if (< StrCnt MaxCnt)
(setq tempStr (strcat tempStr ","))
)
(setq StrCnt (1+ StrCnt))
(setq XValCnt (1+ XValCnt))
)
(setq StrList (cons tempStr StrList))
)
(setq Opened (open "c:/test/ExportedText.csv" "a"))
(foreach str (reverse StrList)
(write-line str Opened)
)
)
)
(*error* nil)
(princ)
)