Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is it possible to populate an existing XLS sheet

36 REPLIES 36
SOLVED
Reply
Message 1 of 37
smaher12
1268 Views, 36 Replies

Is it possible to populate an existing XLS sheet

I already have a lisp that collects X,Y,Z points and creates a .csv file. My problem is I have to cut and paste the data points and put them in this pretty .xls file which contains formulas and conditional formating.

 

So my question is, can I somehow bybass the cut and paste process. Can I append to the existing .xls file? How can I get it to place the data in the correct row/column? Any ideas?

36 REPLIES 36
Message 21 of 37
smaher12
in reply to: hmsilva

Henrique, thank you so much.

 

I did reverse the list and entmake the text. Now I am back to where do I put the following? It doesn't seem to work anywhere. 

 

  (setq xrow (+ xrow pt#)

        yrow (+ yrow pt#)

        zrow (+ zrow pt#)

        sdrow (+ sdrow pt#)

        );; setq

 

Also at the end of your code what does the following do?

(78 2 40 2 nil "end of " 75 9 0 0 0 T T nil T)

Message 22 of 37
bhull1985
in reply to: smaher12

That looks like it's in case of appended information in order to put the information in the correct location within Excel.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
Message 23 of 37
hmsilva
in reply to: smaher12

Hi smaher12,
attach the modified code...

Henrique

EESignature

Message 24 of 37
smaher12
in reply to: hmsilva

Attachment???

Message 25 of 37
hmsilva
in reply to: smaher12

I was asking you to attach the code you have modified...

Henrique

EESignature

Message 26 of 37
smaher12
in reply to: hmsilva

My apologies. See attached. 

Message 27 of 37
hmsilva
in reply to: smaher12

OK,
the only change is the entmake and the reverse, correct?
Do you want the option to de user enter the start row number?

Henrique

EESignature

Message 28 of 37
smaher12
in reply to: hmsilva

Yes, the only change was the entmake and reverse.

 

Row 12 is the starting row. If the user enters 1 for PT# then the data will populate row 12. If the user enters 5 for PT# then the data will populate row 16. 

 

Again, thank you so much for your help.

 

Untitled.gif

 

 

Message 29 of 37
hmsilva
in reply to: smaher12

Try the revised code.

 

HTH

Henrique

EESignature

Message 30 of 37
smaher12
in reply to: hmsilva

My apologies as I did not clarify in my previous post that I do not want the user to specify the Excel starting row.  I need to add 11 to whatever the user specifies for a point number therefore giving the Excel starting row. 

 

If the user enters 1 for the specified point number – the Excel starting row = 12.

If the user enters 3 for the specified point number – the Excel starting row = 14.

 

I don’t know where to add the following for this to work.

 

(setq xrow        11

        yrow         11

        zrow         11

        sdrow       11

); setq

 

(setq xrow (+ xrow pt#)

        yrow (+ yrow pt#)

        zrow (+ zrow pt#)

        sdrow (+ sdrow pt#)

); setq

Message 31 of 37
hmsilva
in reply to: smaher12

Have you tested the code the code in message #29?

Henrique

EESignature

Message 32 of 37
smaher12
in reply to: hmsilva

Yes, and spent a little time to try and alter it to work as described in message #30. No luck.

 

 

Message 33 of 37
hmsilva
in reply to: smaher12


@smaher12 wrote:

Yes, and spent a little time to try and alter it to work as described in message #30. No luck.

 


The xyz2xce_V1.LSP, without being altered, should perform as you need

"If the user enters 1 for the specified point number – the Excel starting row = 12"
"If the user enters 3 for the specified point number – the Excel starting row = 14"

 

Try it.

Henrique

 

EESignature

Message 34 of 37
smaher12
in reply to: hmsilva

In xyz2xce_V1.LSP it has 

 

(setq row (getint "\nEnter the Excel Start Row number: <exit>"))

 

I would prefer that it not ask me to enter the Excel Start Row number.

 

(setq PT# (1- (_def PT# 'Getint "\nSpecify point number ")))

 

I'd rather it take the Specified point number (PT#) and add 11 to it to get the row number.

 

 

Message 35 of 37
hmsilva
in reply to: smaher12

Sorry smaher12,

I had not understood correctly, my bad!

Try the revised code...

 

HTH

Henrique

EESignature

Message 36 of 37
smaher12
in reply to: hmsilva

Perfecto!!!

 

I tried so many different combinations and the program would crash or the data was inserted in the wrong row. I just did not understand what was going on. With the answer right in my face I still don't have 100% grasp on how all the functions work together.

 

Again, thank you for patience and all your help. 🙂

 

 

Message 37 of 37
hmsilva
in reply to: smaher12

You're welcome, smaher12
Glad I could help

Henrique

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

”Boost