is it possible to change sheet name with apache poi MS excel java android

funfordevelopping picture funfordevelopping · Feb 21, 2014 · Viewed 34.3k times · Source

is there any way to update existing sheet name of MS Excel file knowing that I am using apache poi in my android app

I can create a sheet with my custom name

HSSFSheet sheet = workbook.createSheet("my custom name");

but when I want to copy another sheet to this one , the name also is copied and my custom name is crashed

Answer

nikis picture nikis · Feb 21, 2014

The following should do the trick:

workbook.setSheetName(workbook.getSheetIndex(sheet), "newName");