<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using LISp to edit my Block with an Excel Sheet in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13943378#M168623</link>
    <description>&lt;P&gt;NICCCEEE THANKS FOR YOUR HELP!!!&lt;/P&gt;</description>
    <pubDate>Fri, 12 Dec 2025 22:55:56 GMT</pubDate>
    <dc:creator>tnunneryBQFBL</dc:creator>
    <dc:date>2025-12-12T22:55:56Z</dc:date>
    <item>
      <title>Using LISp to edit my Block with an Excel Sheet</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13938754#M168508</link>
      <description>&lt;P&gt;Why is AutoCAD not detecting my block name, "1A-Plan_A". Here is the routine I am running, and the properties dialog box of the block in discussion please help me resolve this issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;;; -----------------------------------------&lt;/P&gt;&lt;P&gt;;; UPDATE ATTRIBUTES FOR BLOCK: 1A-PLAN_A&lt;/P&gt;&lt;P&gt;;; ATTRIBUTES: NA, NB, ND1, ND2, NE1, NE2, NHAD, NSHAD&lt;/P&gt;&lt;P&gt;;; -----------------------------------------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun StrSplit (str delim / pos lst)&lt;/P&gt;&lt;P&gt;&amp;nbsp; (while (setq pos (vl-string-search delim str))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq lst (cons (substr str 1 pos) lst))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq str (substr str (+ pos (strlen delim) 1)))&lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp; (reverse (cons str lst))&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun ReadCSV (path / file line rows)&lt;/P&gt;&lt;P&gt;&amp;nbsp; (setq file (open path "r"))&lt;/P&gt;&lt;P&gt;&amp;nbsp; (while (setq line (read-line file))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq rows (cons (StrSplit line ",") rows))&lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp; (close file)&lt;/P&gt;&lt;P&gt;&amp;nbsp; (reverse rows)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun GetAttributes (blk)&lt;/P&gt;&lt;P&gt;&amp;nbsp; (vl-remove-if&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'null&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (mapcar&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '(lambda (x)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (if (= (vla-get-ObjectName x) "AcDbAttribute")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (vlax-safearray-&amp;gt;list&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (vlax-variant-value (vla-getAttributes blk))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun c:UpdatePlanA ( / csv data headers rows ss blk att tag idx row rowIndex)&lt;/P&gt;&lt;P&gt;&amp;nbsp; (setq csv (getfiled "Select CSV file" "" "csv" 0))&lt;/P&gt;&lt;P&gt;&amp;nbsp; (if (not csv)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (progn (princ "\nCanceled.") (exit))&lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;; Read CSV&lt;/P&gt;&lt;P&gt;&amp;nbsp; (setq data (ReadCSV csv))&lt;/P&gt;&lt;P&gt;&amp;nbsp; (setq headers (mapcar 'strcase (car data)))&lt;/P&gt;&lt;P&gt;&amp;nbsp; (setq rows (cdr data))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;; Select block by exact name&lt;/P&gt;&lt;P&gt;&amp;nbsp; (setq ss (ssget "X" '((2 . "1A-PLAN_A"))))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; (if (not ss)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (progn (princ "\nNo blocks named 1A-PLAN_A found.") (exit))&lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; (setq rowIndex 0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;; Update each block&lt;/P&gt;&lt;P&gt;&amp;nbsp; (repeat (sslength ss)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq blk (vlax-ename-&amp;gt;vla-object (ssname ss rowIndex)))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq row (nth rowIndex rows))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq attlist (GetAttributes blk))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (foreach att attlist&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq tag (strcase (vla-get-TagString att)))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq idx (vl-position tag headers))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (if idx&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (vla-put-TextString att (nth idx row))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq rowIndex (1+ rowIndex))&lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; (princ "\n✓ Block 1A-PLAN_A updated.")&lt;/P&gt;&lt;P&gt;&amp;nbsp; (princ)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Block Prop.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1603578i5285974DFD256588/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Block Prop.png" alt="Block Prop.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 09 Dec 2025 21:54:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13938754#M168508</guid>
      <dc:creator>jhowell787JM</dc:creator>
      <dc:date>2025-12-09T21:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using LISp to edit my Block with an Excel Sheet</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13938850#M168512</link>
      <description>&lt;P&gt;What if you try&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq ss (ssget "_x" '((0 . "INSERT")(2 . "1A-PLAN_A")))&lt;/LI-CODE&gt;&lt;P&gt;could you share sample dwg and csv?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Dec 2025 22:45:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13938850#M168512</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2025-12-09T22:45:18Z</dc:date>
    </item>
    <item>
      <title>Re: Using LISp to edit my Block with an Excel Sheet</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13938943#M168513</link>
      <description>&lt;P&gt;Just me and some criticize, I read the Excel sheet directly. No need to make a csv. So yes post dwg and CSV/Excel.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Dec 2025 00:58:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13938943#M168513</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2025-12-10T00:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using LISp to edit my Block with an Excel Sheet</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13941844#M168590</link>
      <description>&lt;P&gt;I apologize for the late response I am not the admin on my account so bare with me. but here is the info you asked for and I tried your code adjustment but it didn't work.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Block Prop AND COMMAND LINE.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1604281iA502284A1F6D125A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Block Prop AND COMMAND LINE.png" alt="Block Prop AND COMMAND LINE.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 11 Dec 2025 20:09:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13941844#M168590</guid>
      <dc:creator>jhowell787JM</dc:creator>
      <dc:date>2025-12-11T20:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: Using LISp to edit my Block with an Excel Sheet</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13941847#M168591</link>
      <description>&lt;P&gt;I just posted above, thank you for your help!&lt;/P&gt;</description>
      <pubDate>Thu, 11 Dec 2025 20:10:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13941847#M168591</guid>
      <dc:creator>jhowell787JM</dc:creator>
      <dc:date>2025-12-11T20:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: Using LISp to edit my Block with an Excel Sheet</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13941937#M168592</link>
      <description>&lt;P&gt;I made the following changes:&lt;/P&gt;&lt;P&gt;1) Localize the 3 functions&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;StrSplit&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;ReadCSV&lt;/STRONG&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;GetAttributes&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;by moving them inside the &lt;STRONG&gt;c:UpdatePlanA&lt;/STRONG&gt; function:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:UpdatePlanA 
 ( / GetAttributes ReadCSV StrSplit csv data headers rows ss blk att tag idx row rowIndex)
   
(vl-load-com)
; localize functions   
(defun StrSplit (str delim / pos lst)
  (while (setq pos (vl-string-search delim str))
    (setq lst (cons (substr str 1 pos) lst))
    (setq str (substr str (+ pos (strlen delim) 1)))
  )
  (reverse (cons str lst))
)

(defun ReadCSV (path / file line rows)
  (setq file (open path "r"))
  (while (setq line (read-line file))
    (setq rows (cons (StrSplit line ",") rows))
  )
  (close file)
  (reverse rows)
)

(defun GetAttributes (blk)
  (vl-remove-if
    'null
    (mapcar
      '(lambda (x)
         (if (= (vla-get-ObjectName x) "AcDbAttribute")
           x
         )
       )
      (vlax-safearray-&amp;gt;list
        (vlax-variant-value (vla-getAttributes blk))
      )
    )
  )
)&lt;/LI-CODE&gt;&lt;P&gt;2) Since&amp;nbsp;&lt;SPAN&gt;1A-PLAN_A&amp;nbsp;&lt;/SPAN&gt;is a dynamic Block &amp;amp; not a standard Block &amp;amp; with attributes the ssget function needs to look like this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;  ;; Select block by exact name
  (setq ss (ssget "_X" '((2 . "`*U*,1A-PLAN_A")(66 . 1)))) ; select all blocks including dynamic blocks with attributes
  ; (setq ss (ssget "X" '((2 . "1A-PLAN_A"))))&lt;/LI-CODE&gt;&lt;P&gt;3) Since this selects all dynamic blocks, you'll have to evaluate the effective Block name matches &lt;STRONG&gt;1A-PLAN_A&lt;/STRONG&gt; inside the &lt;STRONG&gt;repeat&lt;/STRONG&gt; function:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;  ;; Update each block
  (repeat (sslength ss)
   (setq blk (vlax-ename-&amp;gt;vla-object (ssname ss rowIndex)))
   (if (eq (vla-get-effectivename blk) "1A-PLAN_A") ; chk if dynamic block matches block name
    (progn &lt;/LI-CODE&gt;&lt;P&gt;4) Since your CSV file contains all text strings AutoCAD reads them and surrounds them with additional quotes changing the values to look like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="paullimapa_3-1765488537044.png" style="width: 473px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1604303i6C73271EC41B00EB/image-dimensions/473x97?v=v2" width="473" height="97" role="button" title="paullimapa_3-1765488537044.png" alt="paullimapa_3-1765488537044.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="paullimapa_0-1765487969468.png" style="width: 447px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1604298iDAAEE98C6F6C1F45/image-dimensions/447x67?v=v2" width="447" height="67" role="button" title="paullimapa_0-1765487969468.png" alt="paullimapa_0-1765487969468.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="paullimapa_1-1765488043615.png" style="width: 527px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1604299i21AB2EEDCF016479/image-dimensions/527x320?v=v2" width="527" height="320" role="button" title="paullimapa_1-1765488043615.png" alt="paullimapa_1-1765488043615.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So I modified the CSV read value by using this line of code which only works as long as the values are in inches:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;      (if idx
        (vla-put-TextString att (strcat (read (nth idx row)) "\""))
;        (vla-put-TextString att (nth idx row))
      ) ; if&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="paullimapa_2-1765488110587.png" style="width: 537px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1604300i1BFF68719FF58543/image-dimensions/537x338?v=v2" width="537" height="338" role="button" title="paullimapa_2-1765488110587.png" alt="paullimapa_2-1765488110587.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Dec 2025 21:29:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13941937#M168592</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2025-12-11T21:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: Using LISp to edit my Block with an Excel Sheet</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13941994#M168593</link>
      <description>&lt;P&gt;When I save each of these localized routines, are they going to be in different save files?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Dec 2025 22:33:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13941994#M168593</guid>
      <dc:creator>tnunneryBQFBL</dc:creator>
      <dc:date>2025-12-11T22:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using LISp to edit my Block with an Excel Sheet</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13942030#M168595</link>
      <description>&lt;P&gt;If they are localized that means they are included inside the main defun statement. If you plan to use these as global then they need to be saved in another lisp file that you would need to load first before running this lisp file. Also this line:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:UpdatePlanA 
 ( / GetAttributes ReadCSV StrSplit csv data headers rows ss blk att tag idx row rowIndex)&lt;/LI-CODE&gt;&lt;P&gt;would drop those three functions&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:UpdatePlanA 
 ( / csv data headers rows ss blk att tag idx row rowIndex)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 11 Dec 2025 23:19:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13942030#M168595</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2025-12-11T23:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using LISp to edit my Block with an Excel Sheet</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13942880#M168607</link>
      <description>&lt;P&gt;Thank you so much for your help! This is the best lisp I've used and it still has the two trailing quotation marks("").&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun c:UpdatePlanA&lt;BR /&gt;(/ StrSplit ReadCSV GetAttributes StripQuotes CleanUnicode CleanField csv rows headers ss blk att attlist tag val row rowIndex)&lt;/P&gt;&lt;P&gt;(vl-load-com)&lt;/P&gt;&lt;P&gt;;; ----------------------------&lt;BR /&gt;;; Split a CSV line&lt;BR /&gt;;; ----------------------------&lt;BR /&gt;(defun StrSplit (str delim / pos lst)&lt;BR /&gt;(while (setq pos (vl-string-search delim str))&lt;BR /&gt;(setq lst (cons (substr str 1 pos) lst))&lt;BR /&gt;(setq str (substr str (+ pos (strlen delim) 1)))&lt;BR /&gt;)&lt;BR /&gt;(reverse (cons str lst))&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;;; ----------------------------&lt;BR /&gt;;; Remove only wrapping quotes (keep inches)&lt;BR /&gt;;; ----------------------------&lt;BR /&gt;(defun StripQuotes (s)&lt;BR /&gt;;; remove only leading and trailing quote if both exist&lt;BR /&gt;(if (and (&amp;gt; (strlen s) 1)&lt;BR /&gt;(= (substr s 1 1) "\"")&lt;BR /&gt;(= (substr s (strlen s) 1) "\""))&lt;BR /&gt;(substr s 2 (- (strlen s) 2))&lt;BR /&gt;s&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;;; ----------------------------&lt;BR /&gt;;; Remove Unicode smart quotes and BOM&lt;BR /&gt;;; ----------------------------&lt;BR /&gt;(defun CleanUnicode (s)&lt;BR /&gt;(foreach pair&lt;BR /&gt;'(("“" . "\"") ("”" . "\"")&lt;BR /&gt;("‘" . "'") ("’" . "'")&lt;BR /&gt;("\uFEFF" . "") ;; BOM&lt;BR /&gt;)&lt;BR /&gt;(setq s (vl-string-subst (cdr pair) (car pair) s))&lt;BR /&gt;)&lt;BR /&gt;s&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;;; ----------------------------&lt;BR /&gt;;; Full field cleaner: trim, strip wrapping quotes only, remove tabs/CR, clean Unicode&lt;BR /&gt;;; ----------------------------&lt;BR /&gt;(defun CleanField (s)&lt;BR /&gt;(setq s (vl-string-trim " \t\r\n" s)) ;; trim whitespace &amp;amp; control chars&lt;BR /&gt;(setq s (StripQuotes s)) ;; remove only wrapping quotes&lt;BR /&gt;(setq s (CleanUnicode s)) ;; normalize unicode&lt;BR /&gt;(while (vl-string-search " " s) ;; remove double spaces&lt;BR /&gt;(setq s (vl-string-subst " " " " s))&lt;BR /&gt;)&lt;BR /&gt;s&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;;; ----------------------------&lt;BR /&gt;;; Read CSV file into list (cleaned)&lt;BR /&gt;;; ----------------------------&lt;BR /&gt;(defun ReadCSV (path / file line rows fields)&lt;BR /&gt;(setq file (open path "r"))&lt;BR /&gt;(while (setq line (read-line file))&lt;BR /&gt;(setq fields (StrSplit line ","))&lt;BR /&gt;(setq fields (mapcar 'CleanField fields))&lt;BR /&gt;(setq rows (cons fields rows))&lt;BR /&gt;)&lt;BR /&gt;(close file)&lt;BR /&gt;(reverse rows)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;;; ----------------------------&lt;BR /&gt;;; Get ATTRIBUTE objects safely&lt;BR /&gt;;; ----------------------------&lt;BR /&gt;(defun GetAttributes (blk)&lt;BR /&gt;(vl-remove-if&lt;BR /&gt;'null&lt;BR /&gt;(mapcar&lt;BR /&gt;'(lambda (x)&lt;BR /&gt;(if (= (vla-get-ObjectName x) "AcDbAttribute")&lt;BR /&gt;x&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(vlax-safearray-&amp;gt;list&lt;BR /&gt;(vlax-variant-value (vla-getAttributes blk))&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;;; ----------------------------&lt;BR /&gt;;; READ CSV FILE (network path, escaped)&lt;BR /&gt;;; ----------------------------&lt;BR /&gt;(setq csv (ReadCSV "P:\\TYLER FOLDER\\UpdatePlanA.csv"))&lt;BR /&gt;(setq headers (car csv))&lt;BR /&gt;(setq rows (cdr csv))&lt;/P&gt;&lt;P&gt;;; ----------------------------&lt;BR /&gt;;; SELECT BLOCK REFERENCES&lt;BR /&gt;;; ----------------------------&lt;BR /&gt;(setq ss (ssget "_X" '((0 . "INSERT")(66 . 1)))) ;; get all block refs w/ attributes&lt;/P&gt;&lt;P&gt;(setq rowIndex 0)&lt;/P&gt;&lt;P&gt;;; ----------------------------&lt;BR /&gt;;; LOOP THROUGH SELECTION SET&lt;BR /&gt;;; ----------------------------&lt;BR /&gt;(repeat (sslength ss)&lt;/P&gt;&lt;P&gt;(setq blk (vlax-ename-&amp;gt;vla-object (ssname ss rowIndex)))&lt;BR /&gt;(setq rowIndex (1+ rowIndex))&lt;/P&gt;&lt;P&gt;;; Only process dynamic blocks whose effective name = "1A-PLAN_A"&lt;BR /&gt;(if (= (vla-get-EffectiveName blk) "1A-PLAN_A")&lt;/P&gt;&lt;P&gt;(progn&lt;BR /&gt;(setq attlist (GetAttributes blk))&lt;BR /&gt;(setq row (nth (- rowIndex 1) rows)) ;; match row to block position&lt;/P&gt;&lt;P&gt;;; ----------------------------&lt;BR /&gt;;; Update attributes&lt;BR /&gt;;; ----------------------------&lt;BR /&gt;(foreach att attlist&lt;BR /&gt;(setq tag (strcase (vla-get-TagString att)))&lt;/P&gt;&lt;P&gt;;; find matching header&lt;BR /&gt;(setq idx (vl-position tag (mapcar 'strcase headers)))&lt;/P&gt;&lt;P&gt;(if idx&lt;BR /&gt;(progn&lt;BR /&gt;(setq val (nth idx row))&lt;BR /&gt;(vla-put-TextString att val) ;; val now keeps inch marks&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;(princ "\nDone updating PLAN_A blocks.")&lt;BR /&gt;(princ)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you tell me where it's incorrect?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2025 15:03:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13942880#M168607</guid>
      <dc:creator>tnunneryBQFBL</dc:creator>
      <dc:date>2025-12-12T15:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: Using LISp to edit my Block with an Excel Sheet</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13943143#M168613</link>
      <description>&lt;P&gt;can you also share your CSV file if you changed the contents from before?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2025 18:05:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13943143#M168613</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2025-12-12T18:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using LISp to edit my Block with an Excel Sheet</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13943147#M168615</link>
      <description>&lt;P&gt;i haven't changed the csv. file at all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2025 18:13:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13943147#M168615</guid>
      <dc:creator>tnunneryBQFBL</dc:creator>
      <dc:date>2025-12-12T18:13:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using LISp to edit my Block with an Excel Sheet</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13943231#M168617</link>
      <description>&lt;P&gt;I'm unable to get this function you added to run through...instead the code just gets stuck here and I would have to hit Esc to get out&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun CleanField (s)
(setq s (vl-string-trim " \t\r\n" s)) ;; trim whitespace &amp;amp; control chars
(setq s (StripQuotes s)) ;; remove only wrapping quotes
(setq s (CleanUnicode s)) ;; normalize unicode
(while (vl-string-search " " s) ;; remove double spaces
(setq s (vl-string-subst " " " " s))
)
s
)&lt;/LI-CODE&gt;&lt;P&gt;Also you dropped the selection of dynamic blocks&amp;nbsp; by changing this ssget function to this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq ss (ssget "_X" '((0 . "INSERT")(66 . 1)))) ;; get all block refs w/ attributes&lt;/LI-CODE&gt;&lt;P&gt;It should stay as :&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq ss (ssget "_X" '((2 . "`*U*,1A-PLAN_A")(66 . 1)))) ; select all blocks including dynamic blocks with attributes&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 12 Dec 2025 20:00:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13943231#M168617</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2025-12-12T20:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using LISp to edit my Block with an Excel Sheet</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13943362#M168622</link>
      <description>&lt;P&gt;Ok, I figured out what the problem was with the pasted code in your message.&lt;/P&gt;&lt;P&gt;This &lt;STRONG&gt;CleanField&lt;/STRONG&gt; function is missing the second space when you copy &amp;amp; pasted the code directly into the body of the message:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(while (vl-string-search " " s) ;; remove double spaces&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(setq s (vl-string-subst " " " " s))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The better way to copy &amp;amp; paste code is to first click on this &lt;STRONG&gt;&amp;lt;/&amp;gt;&lt;/STRONG&gt; on the top bar of the message composition window:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="paullimapa_0-1765577391428.png" style="width: 628px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1604612i28933FFC10255D48/image-dimensions/628x107?v=v2" width="628" height="107" role="button" title="paullimapa_0-1765577391428.png" alt="paullimapa_0-1765577391428.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Then paste the code into the popup window that appears:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="paullimapa_1-1765577523170.png" style="width: 528px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1604613i4F58FEA436FDC400/image-dimensions/528x247?v=v2" width="528" height="247" role="button" title="paullimapa_1-1765577523170.png" alt="paullimapa_1-1765577523170.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;    (while (vl-string-search "  " s)  ;; remove double spaces
      (setq s (vl-string-subst " " "  " s))
    )&lt;/LI-CODE&gt;&lt;P&gt;Now the double spaces appear properly.&lt;/P&gt;&lt;P&gt;Also for very long code it's best to include as attachment by dragging &amp;amp; dropping into the section at the bottom of the message composition window:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="paullimapa_2-1765577647272.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1604614iDC9BE18C90796EF0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="paullimapa_2-1765577647272.png" alt="paullimapa_2-1765577647272.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Or you can also just click on the word &lt;STRONG&gt;browse&lt;/STRONG&gt; and then select "&lt;STRONG&gt;Show all files&lt;/STRONG&gt;" to look for the file on the saved location to attach.&lt;/P&gt;&lt;P&gt;1) To remove that last hanging quote I added one more line of code at the end of the&amp;nbsp;&lt;STRONG&gt;CleanField&lt;/STRONG&gt; function:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;  ;; ----------------------------
  ;; Full field cleaner: trim, strip wrapping quotes only, remove tabs/CR, clean Unicode
  ;; ----------------------------
  (defun CleanField (s) 
    (setq s (vl-string-trim " \t\r\n" s)) ;; trim whitespace &amp;amp; control chars
    (setq s (StripQuotes s)) ;; remove only wrapping quotes
    (setq s (CleanUnicode s)) ;; normalize unicode
    (while (vl-string-search "  " s)  ;; remove double spaces
      (setq s (vl-string-subst " " "  " s))
    )
    (setq s (vl-string-subst "" "\"" s)) ; removes quote at end 
    s
  )&lt;/LI-CODE&gt;&lt;P&gt;2)&amp;nbsp; I also began &amp;amp; ended the &lt;STRONG&gt;UpdatePlanA&lt;/STRONG&gt; function with &lt;STRONG&gt;Undo Begin&lt;/STRONG&gt; &amp;amp; &lt;STRONG&gt;Undo End&lt;/STRONG&gt; so that after running &lt;STRONG&gt;UpdatePlanA&lt;/STRONG&gt; you can enter &lt;STRONG&gt;Undo&lt;/STRONG&gt; to revert back to before running the function.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;  ;; ---------------------------
  ;; Begin Undo
  ;; ---------------------------  
  (command "_.Undo" "_Be") &lt;/LI-CODE&gt;&lt;LI-CODE lang="general"&gt;  ;; ---------------------------
  ;; End Undo
  ;; ---------------------------  
  (command "_.Undo" "_E") &lt;/LI-CODE&gt;&lt;P&gt;3) After reading the CSV file I changed the code so that the header row is retrieved and capitalized and the single row of data after is also retrieved:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;;  (setq headers (car csv)) ; header labels
  (setq headers (mapcar 'strcase (car csv))) ; capitalize header labels
;  (setq rows (cdr csv))  
  (setq rows (cadr csv))  ; get one row of data&lt;/LI-CODE&gt;&lt;P&gt;4)&amp;nbsp; I added back the checking of selection set in case nothing is found the code exits:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;  ;; ----------------------------
  ;; SELECT BLOCK REFERENCES
  ;; ----------------------------
  ;(setq ss (ssget "_X" '((0 . "INSERT")(66 . 1)))) ;; get all block refs w/ attributes
  (setq ss (ssget "_X" '((2 . "`*U*,1A-PLAN_A") (66 . 1)))) ; select all blocks including dynamic blocks with attributes

  (if (not ss)
    (progn (princ "\nNo blocks named 1A-PLAN_A found.") (exit))
  )&lt;/LI-CODE&gt;&lt;P&gt;5) Since the headers have already been capitalized &amp;amp; data row has already been retrieved, the follow changes are also made here:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;    ;; Only process dynamic blocks whose effective name = "1A-PLAN_A"
    (if (= (vla-get-EffectiveName blk) "1A-PLAN_A") 

      (progn 

        (setq attlist (GetAttributes blk))
;        (setq row (nth (- rowIndex 1) rows)) ;; match row to block position

        ;; ----------------------------
        ;; Update attributes
        ;; ----------------------------
        (foreach att attlist 
          (setq tag (strcase (vla-get-TagString att)))

          ;; find matching header
;          (setq idx (vl-position tag (mapcar 'strcase headers)))
          (setq idx (vl-position tag headers))

          (if idx 
            (progn 
;              (setq val (nth idx row))
              (setq val (nth idx rows))
              (vla-put-TextString att val) ;; val now keeps inch marks
            )
          )
        )
      )
    )&lt;/LI-CODE&gt;&lt;P&gt;6) Lastly I used &lt;STRONG&gt;Visual Studio Code'&lt;/STRONG&gt;s right mouse click and &lt;STRONG&gt;Format Document&lt;/STRONG&gt; feature to properly format (beatify) the code:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="paullimapa_3-1765578481751.png" style="width: 684px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1604615iB834B938FB98686B/image-dimensions/684x675?v=v2" width="684" height="675" role="button" title="paullimapa_3-1765578481751.png" alt="paullimapa_3-1765578481751.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Check out the attached modified code.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2025 22:31:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13943362#M168622</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2025-12-12T22:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: Using LISp to edit my Block with an Excel Sheet</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13943378#M168623</link>
      <description>&lt;P&gt;NICCCEEE THANKS FOR YOUR HELP!!!&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2025 22:55:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13943378#M168623</guid>
      <dc:creator>tnunneryBQFBL</dc:creator>
      <dc:date>2025-12-12T22:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: Using LISp to edit my Block with an Excel Sheet</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13943382#M168624</link>
      <description>&lt;P&gt;you are welcome...cheers!!!&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2025 23:04:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/using-lisp-to-edit-my-block-with-an-excel-sheet/m-p/13943382#M168624</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2025-12-12T23:04:03Z</dc:date>
    </item>
  </channel>
</rss>

