Fast edit of Excel file
First thing you should do is only write the file out once, not 20,000 times ;-)

Move the wb.write(fileOut); to be outside the loop.....

Additionally, there may be some improvement by reversing the loop:

for(int i=2;i &lt;20002;i++){


can become:

for(int i=20001;i &gt;= 2;i--){


This may make some memory management in the API faster.