Load XL library from here:
http://www.theswamp.org/index.php?to...4520#msg464520
then add this code in Startup Suite, then run this code after:
Code:
;| sample example to show how to read data from Excel with user interaction|;
;;_______________________________________________________________;;
(defun C:XLTXT(/ lst path rangeinfo result xlapp xlbook xlbooks xlcell xlrange xlsheet xlsheets)
(vl-load-com)
(setq xlapp (xlgetapp))
(_set xlapp 'visible :vlax-false)
;|check if no Excel documents were open|;
(if (xlhasbooks xlapp)
;| if one or more open then get active document|;
(setq xlbook (xlgetactivebook xlapp))
(progn
;|otherwise ask user to select document from file dialog|;
(setq path (getfiled "Select Excel file to read data from :" (getvar "dwgprefix") "xls;xlsx" 16 ))
;| get Workbooks collection|;
(setq xlbooks (xlgetbooks xlapp))
;| open selected document|;
(setq xlbook (xlopenbook xlbooks path))
;| activate this document (optional)|;
(setq xlbook (xlgetactivebook xlapp))
)
)
;| get Worksheets collection|;
(setq xlsheets (xlgetsheets xlbook))
;| get Worksheet object by index or by sheet name|;
(setq xlsheet (xlgetsheet xlsheets 1))
;|or the same sheet|;
;|(setq xlsheet (xlgetsheet xlsheets "Sheet1"))|;
(_set xlapp 'visible :vlax-true)
;| activate this sheet|;
(setq xlsheet (xlactivate xlsheet))
;|some different technic to read data|;
;| by selecting desired cell range on Excel screen|;
(setq rangeinfo (xlgetreference xlapp "Select a Range of Cells" "Read Cell Range Example"))
;|or using simplified function "xlreadrangebyref": |;
(setq result (xlreadrangebyref xlapp (cadr rangeinfo) nil))
;;|or using extended function "xlreadrange": |;
;;(setq result (xlreadrange xlapp (cadr rangeinfo) nil nil nil ))
;|let Excel to display alert box to inform user|;
(xlshout xlapp :vlax-true)
;|we don't need to save document, so we can close it without saving|;
(xlbookclose xlbook nil)
;|quit Excel application|;
(xlquit xlapp)
;| clean up memory and relese objects we're using|;
;| better yet they follow in anti-hierarchical order|;
;| from child to parent|;
(xlcleanup (list xlcell xlrange xlsheet xlsheets xlbook xlapp))
(setq xlapp nil)
;|go to Acad|;
(setq lst (vl-remove-if '(lambda (x)(not (eq "B-01" (car x))))result))
(alert (vl-princ-to-string lst))
(alert "Do whatwever you need with retrieved list here")
(princ)
)
~'J'~