Forum Moderators: open
You are either looking for a way to alter excel documents from JavaScript, which is looking for trouble, will only work on Windows platforms, and only with the proper ActiveX objects installed, and so on. In this case you actually need some excel macros or something equivalent.
Or (which I find more likely to be the case), you are looking for a Java code which does work with excel document, but if that's the case, you posted the question to the wrong forum, this is about the JavaScript (client-side scripting language), not about the Java, which is a more robust programming language, and has almost nothing to do with JavaScript.