AutoCad read values of a certain cells in Excel

AutoCad read values of a certain cells in Excel

Anonymous
Not applicable
1,839 Views
10 Replies
Message 1 of 11

AutoCad read values of a certain cells in Excel

Anonymous
Not applicable

I am looking for a way in lisp to have AutoCad read values of a certain cells in Excel.
something along the lines of
(setq cust_name (MI_askstrng "Enter Customer Name.....:"))

 

but instead of "Enter Customer Name", I would like it to read chosen Excel Doc, Sheet 1, Cell B2.

0 Likes
Accepted solutions (2)
1,840 Views
10 Replies
Replies (10)
Message 2 of 11

dbhunia
Advisor
Advisor
Accepted solution

Check This

 

 


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 3 of 11

Anonymous
Not applicable

Thank you for your reply i have one more doubt if i do not want to select a file and want the program to directly open the file from a folder,

(setq fileName(getfiled "Select Excel File" "C:\Support\LISP FILES\data.xlsx" "xlsx" 16))

 

the above code is not working and it is still asking me to select, thanks in advance

0 Likes
Message 4 of 11

dbhunia
Advisor
Advisor

use this

 

To select File Directly - (setq fileName "C:\\Support\\LISP FILES\\data.xlsx")

 

To select Sheet Directly -(setq sheetName "Sheet Name")

 

 


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 5 of 11

Anonymous
Not applicable

Thank you now there is no need to select the file again and again but

whwnever i select the cell it shows-

; error: bad argument type: VLA-OBJECT #<%catch-all-apply-error%>

0 Likes
Message 6 of 11

dbhunia
Advisor
Advisor

Make sure about "Entered File Path" & "Sheet Name" existence.

 

 

 


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 7 of 11

Anonymous
Not applicable

it seems like the problem is with this line 

;;;--- Get the excel file
(setq fileName "C:\\Support(WL)\data.xls")

 but i am not sure what

0 Likes
Message 8 of 11

dbhunia
Advisor
Advisor
Accepted solution

@Anonymous wrote:

it seems like the problem is with this line 

;;;--- Get the excel file
(setq fileName "C:\\Support(WL)\data.xls")

 but i am not sure what


 

It should be.......

 

(setq fileName "C:\\Support(WL)\\data.xls")

 

 


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 9 of 11

Anonymous
Not applicable

i have a doubt, can you please explain what is the meaning of the code-

 

cus_name (MI_askstrng "Enter Customer name....:" (nth 0 #TTLE))
#TTLE (LI_RepList #TTLE 1 cus_name)

0 Likes
Message 10 of 11

dbhunia
Advisor
Advisor

I did not get all the things .......

 

post the code......

 

 


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 11 of 11

JBerns
Advisor
Advisor

@dbhunia,

 

Do you know where else I may search for Jeffery P Sanders AutoLISP collection for reading and searching Excel (XLS/XLSX) files? The link in your message reports the site can't be reached. Perhaps the site is just temporarily down.

 

Thank you for your time and attention. I look forward to your reply.

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
0 Likes