Using iLogic to change a value in embedded excel

d.salas.lazzari
Participant
Participant

Using iLogic to change a value in embedded excel

d.salas.lazzari
Participant
Participant

Hello, I would like to ask you for help (if this is feasible to do) with something that i am trying to achieve.

I have some .ipt parts that carry an embedded excel spreadsheet. For example i have a WN flange that on the sheet1 page has a simple table with the parameters on it. These changes when the "nominal diameter" changes.

I would like to know if it possible to write an iLogic code that overwrites (changes) the "nominal diameter" value so all other parameters change autimatically an the part updates.

It would be very useful since it would avoid opening the excel file every time.

 

Thanks in advance to anyone that will be willing to help me

 

0 Likes
Reply
Accepted solutions (1)
406 Views
5 Replies
Replies (5)

d.salas.lazzari
Participant
Participant

Thanks! I will take a look at the posts!

0 Likes

A.Acheson
Mentor
Mentor
Accepted solution

Hi @d.salas.lazzari 

This snippet exist in your ilogic editor and here is a help page to better understand these snippets and functions.

In your parameter box you will see the name of the embedded excel file so change the code to match this name.

 

The example below will search for a column for a specific value and then return the row number. Once you have a row number you can either search another column and get a value (shown below or you could set a value.

i = GoExcel.FindRow("3rd Party:Embedding 1", "Sheet1", "Dia", "=", 0.2)
MessageBox.Show("Row No " & 1 )
dia =  GoExcel.CurrentRowValue("Dia")

MessageBox.Show(dia)

 Set a value

GoExcel.CellValue("3rd Party:Embedding 1", "Sheet1", "A1")= "1234"

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes

d.salas.lazzari
Participant
Participant

UPDATE: Nevermind, i found it

 

adding GoExcel.Save

 

it updates the part when value is changed!

 

Thank you very much! Always on point!

-------------------------------------------------------------------------------------------
Hello @A.Acheson, thanks for the reply, it seems that effectively that is the way.

So i just added the second part to change the value in the embedded excel, and it actually changes it!

BUT, i still have to open the excel in order to have all the parameters updated, otherwise the ipt won't update

 

I am adding the file on this post, if you could take a little look, hope to not be bothering

0 Likes

d.salas.lazzari
Participant
Participant

posting the solved file as a start point for future posts, @A.Acheson if you have some advise it will be very much welcomed

0 Likes