Try this one,
(defun c:testthis ( / MySel MyFile CSVFile acount MyEnt Ent1 MyValue MySuffix)
(vl-load-com)
(if CSVFile (close CSVFile)) ;; Close 'CSVfile' in case it is open, prevents some errors
(setq MyFile (getfiled "Save file as: " (getvar 'DWGPREFIX) "csv" 1)) ;; Select CSV file / make new CSV File
(setq MySel (ssget '((0 . "*DIMENSION")))) ;; Select only dimensions
(setq CSVFile (open MyFile "w")) ;; Open CSV File to write to
(write-line (strcat "Test Override, Pieces, Measurement") CSVFile) ;; Write header row to file
(setq acount 0) ;; Counter for while loop
(while (< acount (sslength MySel)) ;; Loop for number of selected dimensions
(setq MyEnt (entget (ssname MySel acount))) ;; get nth dimension entity data
(setq Ent1 (cdr (assoc 1 MyEnt)) ) ;; assoc 1: text in dimension
(setq MySuffix (substr Ent1 ( + (vl-string-search "(" Ent1) 1))) ;; get sub-string after '(' in Ent1 value
(setq MyValue (vl-string-trim MySuffix Ent1))
(setq MyValue (vl-string-subst (vl-princ-to-string (cdr (assoc 42 MyEnt))) (strcat (chr 60) (chr 62)) MyValue))
;; MyValue dimension text without '(...)', '42' is measured value
(write-line (strcat MyValue ", " MySuffix ", " (vl-princ-to-string (cdr (assoc 42 MyEnt))) ) CSVFile) ;; write values to CSV file
(setq acount (+ acount 1)) ;; Increase loop counter
) ; end while ;; end loop
(close CSVFile) ;; close CSV file
(princ)
)