Balaji.N.S
Balaji.N.S

Reputation: 743

JXL rename a sheet

Hi I have a template excel which I load and would like to change a sheet name in that.

WritableWorkbook workbook = jxl.Workbook.createWorkbook(file1,template);

This workbook has n sheets. I would like to change the name of a single sheet. Incase of remove there is a method called

workbook.removeSheet(<sheet index>)

I dont find any such direct method for rename.

Can someone help me in this regard.

Upvotes: 3

Views: 2474

Answers (2)

el arby
el arby

Reputation: 21

workbook.createSheet("Name", i);
WritableSheet excelSheet = workbook.getSheet(i);

and to modify the name

excelSheet.setName("new name");

Upvotes: 2

qwerty
qwerty

Reputation: 3869

No direct method seems to exist. I'd try a copySheet(oldName, newName,newIndex) followed by a removeSheet(oldIndex)

Upvotes: 2

Related Questions