RecipesExport to Excel and PDF
How do I export all the text from an AutoCAD drawing to Excel?
Type "list every text and mtext in the drawing with its layer and contents, as a table". cadssistant reads the contents and layer of each TEXT and MTEXT in one pass and replies with a table; Copy puts it on the clipboard as tab-separated text for Excel, and the Excel button saves a CSV through AutoCAD's save dialog. Say "attributes too" to include block attribute values, or "only on A-ANNO" to filter.
Checked 2026-10-30
list every text and mtext in the drawing with its layer and contents, as a table
What cadssistant does
- Selects TEXT and MTEXT (and, if you ask, the ATTRIB entities inside blocks) with one filter and reads the contents (group code 1) and layer (8) of each.
- Replies with a table: layer and contents, plus handle, height, X and Y if you ask for them. MTEXT contents come with their formatting codes (\P, fonts); say "strip the formatting codes" for plain text.
- Copy (tab-separated) or Excel (CSV via AutoCAD's save dialog) on the table. The reply is the export.
The same task in AutoLISP
(progn
(setq ss (ssget "_X" '((0 . "TEXT,MTEXT"))) i 0
f (open "C:/temp/text.csv" "w"))
(write-line "handle,layer,height,x,y,text" f)
(if ss
(repeat (sslength ss)
(setq ed (entget (ssname ss i)) i (1+ i) p (cdr (assoc 10 ed)))
(write-line (strcat (cdr (assoc 5 ed)) "," (cdr (assoc 8 ed)) ","
(rtos (cdr (assoc 40 ed)) 2 2) ","
(rtos (car p) 2 3) "," (rtos (cadr p) 2 3) ",\""
(cdr (assoc 1 ed)) "\"") f)))
(close f)
(if ss (sslength ss) 0))Quotes the text column. A text containing a double quote still needs escaping, and MTEXT over 250 characters continues in group 3 codes this line doesn't read.
More in export to excel and pdf
Command: CADSSISTANT
Works in AutoCAD 2024 and newer on Windows. Free trial, no card, no API key.
Get cadssistant