I'm hardly an Excel power user, so I'm not sure what you mean by an Excel code, but perhaps waht you are looking cor can be accomplished just by linking the spreadsheet (if you are placing the spreadsheet or a range directly), or by using Data Merge.
There is a preference setting to allow spreadsheets and text files to be linked instead of emebeded, and it can be turned on before placing particular files and then turned off again if you like. To avoid loss of fromatting, however, when the spreadsheet updates you must either use Table Styles in ID or do the formatting in the spreadsheet itself.
With Data Merge you can set up the merge template on a master page and in theory the data will update automatically if the data file is changes, but I've never had a lot of luck with that. On the other hand, I've not foound it to be a great burden to save a new data file from Excel after updating the spreadsheet and then simply re-run my merge.
You should take a look at AutoPrice offered thru a company Meadows Publishing Solutions:
What you describe sounds like AutoPrice is the solution.
thanks so much to all
i will try any advice...