<?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: Lisp to extract excel data into text to be inserted to autocad in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12899909#M12074</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15580015"&gt;@clerigoaaron&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564264"&gt;@pbejse&lt;/a&gt;&amp;nbsp;yes i do.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Only thing I can think of now is the list is not matching with the DXF filenames. the way it works, make a list of the DXF files from the selected folder, read the XLSX file and save the data on a list.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Every drawing name is checked against the Xlsx list. if the name is not found, the program will process the next one&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Can you post here a snapshot of the dxf folder? for the meantime i will add a check where the program stops so you it will spit out a message for the error.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Code at post #16 updated&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jul 2024 06:34:16 GMT</pubDate>
    <dc:creator>pbejse</dc:creator>
    <dc:date>2024-07-16T06:34:16Z</dc:date>
    <item>
      <title>Lisp to extract excel data into text to be inserted to autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12883210#M12054</link>
      <description>&lt;P&gt;I have a dxf file with multiple drawings and the drawing names are in an excel spreadsheet. These drawings are in the 20s-100s so manually using the text command will take time. I was wondering if there is a lisp code to extract the names in excel and place them in the drawing. Like the content of cell A1-A20 will be inserted as text at points 0,0 then the next one will be placed at increments of 200mm down. A2 will be inserted at 0,-200 A3 at 0,400 etc. Also wondering if this will require autocad add ins. Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2024 02:15:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12883210#M12054</guid>
      <dc:creator>clerigoaaron</dc:creator>
      <dc:date>2024-07-08T02:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to extract excel data into text to be inserted to autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12883344#M12055</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15580015"&gt;@clerigoaaron&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I was wondering if there is a lisp code to extract the names in excel and place them in the drawing.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Yes&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15580015"&gt;@clerigoaaron&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Like the content of cell A1-A20 will be inserted as text at points 0,0 then the next one will be placed at increments of 200mm down. A2 will be inserted at 0,-200 A3 at 0,400 etc.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT size="3"&gt;What are the properties of the TEXT entity to be inserted/created at 0,0?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Best that you post a sample drawing showing the intended result.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;HTH&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2024 05:04:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12883344#M12055</guid>
      <dc:creator>pbejse</dc:creator>
      <dc:date>2024-07-08T05:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to extract excel data into text to be inserted to autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12883366#M12056</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564264"&gt;@pbejse&lt;/a&gt;&amp;nbsp;Imagine a rectangle and inside the rectangle says drawing no. &lt;U&gt;(Insert drawing number here from excel)&lt;/U&gt;. the text property will be the same as the property of "drawing no."&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2024 05:37:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12883366#M12056</guid>
      <dc:creator>clerigoaaron</dc:creator>
      <dc:date>2024-07-08T05:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to extract excel data into text to be inserted to autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12883693#M12057</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15580015"&gt;@clerigoaaron&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564264"&gt;@pbejse&lt;/a&gt;&amp;nbsp;Imagine a rectangle and inside the rectangle says drawing no. &lt;U&gt;(Insert drawing number here from excel)&lt;/U&gt;. the text property will be the same as the property of "drawing no."&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT size="3"&gt;And how would the code know what object property of the&amp;nbsp; "drawing no." ? is this a TEXT entity? an Attribute?&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pbejse_0-1720428152521.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1384086i0C2A3E8B1075BA17/image-size/medium?v=v2&amp;amp;px=400" role="button" title="pbejse_0-1720428152521.png" alt="pbejse_0-1720428152521.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":backhand_index_pointing_up:"&gt;👆&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2024 08:45:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12883693#M12057</guid>
      <dc:creator>pbejse</dc:creator>
      <dc:date>2024-07-08T08:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to extract excel data into text to be inserted to autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12885455#M12058</link>
      <description>&lt;P&gt;Need a Excel sample also that matches a dwg.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 00:25:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12885455#M12058</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-07-09T00:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to extract excel data into text to be inserted to autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12886394#M12059</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564264"&gt;@pbejse&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6254908"&gt;@Sea-Haven&lt;/a&gt;&amp;nbsp;This is the code I am working with&lt;/P&gt;&lt;P&gt;(defun c:Insertdxf&amp;nbsp; (/directory files)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(setq directory "C:\\Users\\Desktop\\dxf")&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;(if (setq files (vl-directory-files directory "*.dxf" 1))&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(foreach dxf files&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(setq dxf_file_name (vl-filename-base dxf))&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(command "_.-insert"&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(strcat directory "\\" dxf)&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'(0.0.0.)&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; &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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &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; &amp;nbsp; &amp;nbsp;)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(command "_.text" "0,0" "12" "0" "proj-123")&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(command "_.text" "0,-30" "12" "0" (strcat "dwg no: " dxf_file_name))&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(command "_.text" "0,-45" "12" "0" "pipe no:" &lt;U&gt;&lt;STRONG&gt;*insert pipe number from excel)&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(command "move" "all" "" "0,0,0" "0,500,0")&lt;/P&gt;&lt;P&gt;&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; &amp;nbsp; (princ "\n No DXF files found in that folder!")&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; &amp;nbsp;(princ)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;/P&gt;&lt;P&gt;This code merges multiple dxf files into 1. the number of files sometimes goes to 50 - 100 which is very tiring to do manually. The code works and I want to improve on it. The excel file is just a regular file with column A as the dwg no with column B as the corresponding pipe no. I would also wish to change the line that takes the file name as string and places it as text next to the "dwg no:" since that information is also in the excel file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;If my explanation is too vague i can clarify. sorry I have little knowledge in lisp.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 12:05:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12886394#M12059</guid>
      <dc:creator>clerigoaaron</dc:creator>
      <dc:date>2024-07-09T12:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to extract excel data into text to be inserted to autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12886598#M12060</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15580015"&gt;@clerigoaaron&lt;/a&gt;&amp;nbsp; hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You're been asking to post a sample xlsx file at least two times.&lt;/P&gt;&lt;P&gt;if you do not have one, then create. experts here are trying to understand how this file looks like?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moshe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 13:17:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12886598#M12060</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2024-07-09T13:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to extract excel data into text to be inserted to autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12886666#M12061</link>
      <description>&lt;P&gt;Here is a sample of the excel file. The lisp code also inserts the dxf files based on the file name which are named numerically based on the excel file&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 13:42:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12886666#M12061</guid>
      <dc:creator>clerigoaaron</dc:creator>
      <dc:date>2024-07-09T13:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to extract excel data into text to be inserted to autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12887818#M12062</link>
      <description>&lt;P&gt;&amp;nbsp;Ok a couple of suggestions can get a selection from excel. Either read all cells or select range, then make the list of file names and dxfin, make a string of Filename &amp;amp; Text then just make a mtext with that string.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For me I would add cell C1 as&amp;nbsp;&lt;SPAN&gt;C:\Users\Desktop\dxf so know where to find the dxf's.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SeaHaven_1-1720569618942.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1384938iFF70502DF86C9EDE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SeaHaven_1-1720569618942.png" alt="SeaHaven_1-1720569618942.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Limited testing please try this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/td-p/12883210

; read a excel and import dxf plus text
; By AlanH July 2024


(defun c:xldxf ( / pt1 st end row str  path)
;;	Thanks to fixo			;;
(defun getcell2 (row column / )
(setq cells (vlax-get-property  (vlax-get-property myxl "ActiveSheet") "Cells"))
(setq cell (vlax-get (vlax-variant-value  (vlax-get-property cells "Item" row column)) 'value))
)

; thanks to Lee-mac for this defun 
; www.lee-mac.com
; 44 is comma 9 is tab 34 is space 58 is colon
(defun _csv-&amp;gt;lst58 ( str / pos )
	(if (setq pos (vl-string-position 58 str))
		(cons (substr str 1 pos) (_csv-&amp;gt;lst58 (substr str (+ pos 2))))
		(list str)
    )
)

; ColumnRow - Returns a list of the Column and Row number
; Function By: Gilles Chanteau from Marseille, France
; Arguments: 1
;   Cell$ = Cell ID
; Syntax example: (ColumnRow "ABC987") = '(731 987)
;default to "A1" if there's a problem
;-------------------------------------------------------------------------------
(defun ColumnRow (Cell$ / Column$ Char$ Row#)
  (setq Column$ "")
  (while (&amp;lt; 64 (ascii (setq Char$ (strcase (substr Cell$ 1 1)))) 91)
    (setq Column$ (strcat Column$ Char$)
          Cell$ (substr Cell$ 2)
    )
  )
  (if (and (/= Column$ "") (numberp (setq Row# (read Cell$))))
    (list (Alpha2Number Column$) Row#)
    '(1 1)
  )
)

; Alpha2Number - Converts Alpha string into Number
; Function By: Gilles Chanteau from Marseille, France
; Arguments: 1
;   Str$ = String to convert
; Syntax example: (Alpha2Number "ABC") = 731
;-------------------------------------------------------------------------------
(defun Alpha2Number (Str$ / Num#)
  (if (= 0 (setq Num# (strlen Str$)))
    0
    (+ (* (- (ascii (strcase (substr Str$ 1 1))) 64) (expt 26 (1- Num#)))
       (Alpha2Number (substr Str$ 2))
    )
  )
)

(defun getrangexl ( / lst UR CR RADD cnt)
(setq lst '())
(setq UR (vlax-get-property  (vlax-get-property myxl "ActiveSheet") "UsedRange"))
(setq CR (vlax-get-property UR "CurrentRegion"))
(setq RADD (vlax-get-property CR "Address"))
(setq cnt (vlax-get-property CR  "Count"))
(setq lst (_csv-&amp;gt;lst58 radd))
(setq st (vl-string-subst "" "$" (vl-string-subst "" "$" (nth 0 lst) )))
(setq end (vl-string-subst "" "$" (vl-string-subst "" "$" (nth 1 lst) )))
(setq st  (columnrow st))
(setq end  (columnrow end))
)

;;;;;;;;;;;;;;;;;;;; starts here

(or (setq myxl (vlax-get-object "Excel.Application"))
    (setq myxl (vlax-get-or-create-object "excel.Application"))
)
(vla-put-visible myXL :vlax-true)
(vlax-put-property myxl 'ScreenUpdating :vlax-true)
(vlax-put-property myXL 'DisplayAlerts :vlax-true)

(getrangexl)

(setq path (getcell2 1 3))
(setq row 2)

(repeat (- (cadr end) 1)
  (setq dwg (strcat path  (getcell2 row 1) ".dxf"))
  (command "_.-insert" dwg "0,0,0" 1 1 0)
  (setq row (+ row 1))
)

(setq row 2)
(setq str "")

(repeat (- (cadr end) 1)
  (setq c2 (getcell2 row 2))
  (if (or (= (TYPE c2) 'REAL)(= (TYPE c2) 'INT)) (setq c2 (RTOS c2 2 0)))
  (setq str (strcat str (getcell2 row 1) (chr 9) c2 "\\P"))
  (setq row (+ row 1))
)

(setq pt1 (getpoint "\nPick point for mtext "))

(entmakex (list (cons 0 "MTEXT")         
  (cons 100 "AcDbEntity")
  (cons 100 "AcDbMText")
  (cons 10 pt1)
  (cons 1 str))
)
				 
(if (not (vlax-object-released-p myXL))(progn(vlax-release-object myXL)(setq myXL nil)))

(princ)
)

(c:xldxf)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 02:19:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12887818#M12062</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-07-15T02:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to extract excel data into text to be inserted to autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12888738#M12063</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6254908"&gt;@Sea-Haven&lt;/a&gt;&amp;nbsp;Thanks for the reply. Im a complete newbie and dont know how to use this. Is this all a single lisp file? or are these separate? like each defun is a different lisp file and you gave me alot to try? Also how will the code know which excel file to get the data from. Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 11:12:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12888738#M12063</guid>
      <dc:creator>clerigoaaron</dc:creator>
      <dc:date>2024-07-10T11:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to extract excel data into text to be inserted to autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12890363#M12064</link>
      <description>&lt;P&gt;Ok 1st step copy all the code and save in Notepad a file say xldxf.lsp.&lt;/P&gt;&lt;P&gt;Open the correct excel file. I can add select a file for moment looks at current Excel.&lt;/P&gt;&lt;P&gt;Use appload and load the file.&lt;/P&gt;&lt;P&gt;Type xldxf it should all happen.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 00:08:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12890363#M12064</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-07-11T00:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to extract excel data into text to be inserted to autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12896458#M12065</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6254908"&gt;@Sea-Haven&lt;/a&gt;&amp;nbsp;I tried the code and it says error: bad argument type: numberp: nil. I am using autocad 2024 for this. Is there a need for some add-ins for this to work?&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jul 2024 08:28:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12896458#M12065</guid>
      <dc:creator>clerigoaaron</dc:creator>
      <dc:date>2024-07-14T08:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to extract excel data into text to be inserted to autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12897169#M12066</link>
      <description>&lt;P&gt;I have retested and found that some how a line was deleted in the code so I have updated the code above.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 02:19:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12897169#M12066</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-07-15T02:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to extract excel data into text to be inserted to autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12897420#M12067</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15580015"&gt;@clerigoaaron&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564264"&gt;@pbejse&lt;/a&gt;&amp;nbsp;This is the code I am working with&lt;/P&gt;
&lt;P&gt;(command "_.text" "0,0" "12" "0" &lt;STRONG&gt;"proj-123"&lt;/STRONG&gt;)&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT size="3"&gt;What of the project number source? I'm sure its not always "PRJ-123" ? A project folder would be a good source. Let us know what you think of that approach.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 04:50:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12897420#M12067</guid>
      <dc:creator>pbejse</dc:creator>
      <dc:date>2024-07-15T04:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to extract excel data into text to be inserted to autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12897827#M12068</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564264"&gt;@pbejse&lt;/a&gt;&amp;nbsp;Yes it is not always PRJ123 but project codes are assigned per project based on when we receive the order so i just edit that part of the code every time a new project comes. There is no way to know the project code before hand.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 09:23:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12897827#M12068</guid>
      <dc:creator>clerigoaaron</dc:creator>
      <dc:date>2024-07-15T09:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to extract excel data into text to be inserted to autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12897874#M12069</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15580015"&gt;@clerigoaaron&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564264"&gt;@pbejse&lt;/a&gt;&amp;nbsp;Yes it is not always PRJ123 but project codes are assigned per project based on when we receive the order so i just edit that part of the code every time a new project comes. There is no way to know the project code before hand.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT size="3"&gt;You can however add that data as the first item on your xlsx file.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;Project name | Project-123&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="3"&gt;Drawing No. | Pipe No.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="3"&gt;01 | 12L&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Or you can be prompted for the project name and dxf folder&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;command: Enter Project Name:&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Command: Select DXF files source&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;for now try this&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(Defun c:MakeThisHAppen ( /  ExtractFromXls moveAll fileName XL-App Workbooks exData f textObj moveAll)
(defun ExtractFromXls (st app col / ncol val dataCollection)
      (repeat col
	(setq ncol (cons col ncol))
	(setq col (1- col))
      )
       (while
	 (vl-every 'eval
		   (setq val
			  (mapcar '(lambda (i / cv)
				     (if (Setq cv (vlax-get-property (vlax-get (vlax-get app "ActiveSheet") 'Cells) 'Item st i))
                  			(vlax-variant-value
					  (vlax-get-property
					    (vlax-variant-value cv)
					    'Value
					  )
					)
				       )
				     ) ncol)
		   	)
		   )
	 (setq dataCollection (cons val dataCollection))
	 (setq st (1+ st))
	 )
      dataCollection
       )
			     
(if (and
      		(setq  Directory (acet-ui-pickdir
				 "Select Project Folder" (if Directory Directory (getvar 'dwgprefix))))
      		(setq moveAll (ssadd)
		       dxfFiles (vl-directory-files directory "*.dxf" 1))
		(setq fileName (getfiled "Excel Spreadsheet File"
                                   (if fileName fileName (getvar 'dwgprefix))"XLSX;XLS" 16 ))
        	(setq XL-App    (vlax-get-or-create-object "Excel.Application"))      		
      		(Setq Workbooks (vlax-invoke-method (vlax-get-property XL-App 'WorkBooks)
                                    'Open  fileName ))
      		(setq exData (extractfromxls 1 XL-App 2))
      		
      )
  (progn
	(foreach fname dxfFiles	  
	  (if (Setq f (Assoc (strcase (vl-filename-base  fname)) exData))
		(progn
		  (command "_insert" (strcat directory "\\" fname) '(0.0 0.0 0.0) "" "" "")
		  (ssadd (entlast) moveAll)
		  (foreach strdata (list
				     '((0.0 0.0 0.0) 12 "Proj-123")
				     (list '(0.0 -30.00 0.0) 12
				       (strcat "dwg no: " (vl-filename-base fname)
				       )
				     )
				     (list '(0.0 -45.0 0.0) 12 (strcat "pipe no: " (vl-princ-to-string (Cadr f)))
				     )
				   )
		  (setq textObj (entmakex (list (cons 0 "TEXT")
					    (cons 10 (car strdata))
					    (cons 40 (cadr strdata))
					    (cons 1 (caddr strdata))
				      )
			    )
		  )
		    (ssadd textObj moveAll)
		    (command "_move" moveAll "" "_non" "0,0,0" "0,500,0")
		    )
		  )
	    (princ (Strcat "\n" (vl-filename-base  fname) " Not found on source list"))
		)
		)
  		(vlax-invoke-method Workbooks 'close  fileName )
	    	(vlax-release-object XL-App)
		(vlax-release-object Workbooks)
	    		
	    )
  (Vl-some '(lambda (l)
	      (if (null (eval (Car l)))(print (cadr l))))
	   		'((Directory "No folder selected/Cancelled by user")
			  (dxfFiles "No DXF files found on selected folder")
			  (fileName "No xls:x;sx file found on selected folder / Cancelled by user")
			  (XL-App "Excel application not found")
			  )
		)	   
  )
  (princ)
  )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;EDIT: Added message for "Nothing happened!, What's going on here? "&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2024 08:55:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12897874#M12069</guid>
      <dc:creator>pbejse</dc:creator>
      <dc:date>2024-07-16T08:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to extract excel data into text to be inserted to autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12897925#M12070</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564264"&gt;@pbejse&lt;/a&gt;&amp;nbsp;Thats actually a good idea. I will try it tomorrow, I only have autocad in my work PC. Thank you so much.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 10:25:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12897925#M12070</guid>
      <dc:creator>clerigoaaron</dc:creator>
      <dc:date>2024-07-15T10:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to extract excel data into text to be inserted to autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12899763#M12071</link>
      <description>&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="IMG_20240716_114111.jpg" style="width: 4080px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1387125iF8BA891B2DC0261C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IMG_20240716_114111.jpg" alt="IMG_20240716_114111.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564264"&gt;@pbejse&lt;/a&gt;&amp;nbsp;Tried the code it first asked me to select a folder which i think it means where the dxf files are saved then asked me to select an excel file. After doing that noting happened. Both the dxf files and excel are in the same folder. Using autocad 2024. Here is the actual result in the command prompt&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2024 03:42:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12899763#M12071</guid>
      <dc:creator>clerigoaaron</dc:creator>
      <dc:date>2024-07-16T03:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to extract excel data into text to be inserted to autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12899796#M12072</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15580015"&gt;@clerigoaaron&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;After doing that noting happened. Both the dxf files and excel are in the same folder&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Quick question: Do you have Microsoft Excel on your workstation?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2024 04:24:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12899796#M12072</guid>
      <dc:creator>pbejse</dc:creator>
      <dc:date>2024-07-16T04:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to extract excel data into text to be inserted to autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12899851#M12073</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564264"&gt;@pbejse&lt;/a&gt;&amp;nbsp;yes i do.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2024 05:24:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-extract-excel-data-into-text-to-be-inserted-to-autocad/m-p/12899851#M12073</guid>
      <dc:creator>clerigoaaron</dc:creator>
      <dc:date>2024-07-16T05:24:07Z</dc:date>
    </item>
  </channel>
</rss>

