Read excel cells and create list.
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Read excel cells and create list.

 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization
Author Message
amitvedak
Guest





Posted: Wed Dec 22, 2004 7:18 am    Post subject: Read excel cells and create list. Reply with quote

Hello friends,

Here I am facing a problem in reading excel file through lisp.
I hade download program from this discussions and edited .but it takes too much time for output

Does anybody having program of reading excel file and list same like read-line function of auto lisp

My requirements is as below

Contains of excel file
1000 2000 3000 4000 5000 6000 7000

After reading excel file I need these values in list
Example (“1000” “2000” “3000” “4000” “5000” “6000” “7000”)

Also I need this in loop next lines 1 by one.
Gentlemen’s pls. help me in this.

Regards
Amit

Back to top
Dann
Guest





Posted: Wed Dec 22, 2004 9:32 pm    Post subject: Re: Read excel cells and create list. Reply with quote

This example should get you started: .....Or at least get this thread
started :)

(setq l1 "1000 2000 3000 4000 5000 6000 7000")
(setq l2 nil)
(repeat 7
(setq l1 (vl-string-left-trim " " l1))
(setq tst (rtos (atoi l1) 2 0))
(setq l2 (cons tst l2))
(setq l1 (vl-string-left-trim tst l1))
)
(setq l2 (reverse l2))






"amitvedak" <nospam@address.withheld> wrote in message
news:23003616.1103681954529.JavaMail.jive@jiveforum2.autodesk.com...
Quote:
Hello friends,

Here I am facing a problem in reading excel file through lisp.
I hade download program from this discussions and edited .but it takes too
much time for output

Does anybody having program of reading excel file and list same like
read-line function of auto lisp

My requirements is as below

Contains of excel file
1000 2000 3000 4000 5000 6000 7000

After reading excel file I need these values in list
Example ("1000" "2000" "3000" "4000" "5000" "6000" "7000")

Also I need this in loop next lines 1 by one.
Gentlemen's pls. help me in this.

Regards
Amit
Back to top
kozmos
Guest





Posted: Thu Dec 23, 2004 10:15 am    Post subject: Re: Read excel cells and create list. Reply with quote

you can read/write "vlaue2" property of Excel range vla-object and then conver data between the variant and VL list. This will have a same speed as VB do.

Back to top
amitvedak
Guest





Posted: Thu Dec 23, 2004 7:06 pm    Post subject: Re: Read excel cells and create list. Reply with quote

values shud not be in lisp format
(setq l1 "1000 2000 3000 4000 5000 6000 7000")
are in diff. excel cells
1000 2000 3000 4000 5000 6000 7000
pls. tell me again if u kno.

amit
Back to top
amitvedak
Guest





Posted: Thu Dec 23, 2004 7:07 pm    Post subject: Re: Read excel cells and create list. Reply with quote

thanks 4 reply.

do u have any sample program. coz i am not familer with vlisp functions

amit
Back to top
kozmos
Guest





Posted: Fri Dec 24, 2004 6:45 am    Post subject: Re: Read excel cells and create list. Reply with quote

You can go to http://www/ikozmos.com to download VLXLS.
There is a sample file to show the data exchanged between ACAD and Excel

Following is a very simple to conver Excel data into VL list:

First of all, please load VLXLS.LSP (or vlxls-* functions will not work) and make sure an Excel session with data is opened and set as current active spreadsheet. The codes below will convert all Excel data into VL List

(vlxls-app-init) ;;;Initialize Link between Excel/ACAD
(setq *xl* (vlax-get-object "Excel.Application")) ;;; Get the Excel VLA-Object
(if *xl* (setq Range (vlxls-sheet-get-usedrange *xl* nil))) ;;; Get all used range vla-object
(if Range (setq value (vlax-get-property Range "Value2") ;;; Get the variant value
value (vlxls-variant->list value) ;;; Convert Variant into VL list
))
(vlax-release-object range)
(vlax-release-object *xl*) ;;; Release the vla-object

The return value is a two dimension list, similia format is
'(("" "" "" "")
("" "" "" "")
("" "" "" "")
....
)
Back to top
Jon Fleming
Guest





Posted: Fri Dec 24, 2004 1:25 pm    Post subject: Re: Read excel cells and create list. Reply with quote

In article
<12018700.1103852746611.JavaMail.jive@jiveforum2.autodesk.com>, Kozmos
wrote:
Quote:
You can go to http://www/ikozmos.com to download VLXLS.

ITYM http://www.ikozmos.com/.

--
jrf
Autodesk Discussion Group Facilitator
Please do not email questions unless you wish to hire my services
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB