Excel API Library for Java - Sample Browser | Document Solutions | Add a worksheet
[
フレーム]
src="bundle.js">
Refer to the following example code to see how to add a new worksheet. In the current Demo, you can see the multiple sheets at the bottom of the viewer.
// Create a new workbook
Workbook workbook = new Workbook();
// Add a new worksheet to the workbook. The worksheet will be inserted into the end of the existing worksheet collection.
workbook.getWorksheets().add();
//Add a new worksheet to the specified position in the collection of worksheets.
workbook.getWorksheets().addBefore(workbook.getWorksheets().get(0));
workbook.getWorksheets().addAfter(workbook.getWorksheets().get(1));
//Set worksheet's name.
workbook.getWorksheets().get(2).setName("Product Plan");
// Save to an excel file
workbook.save("AddWorksheet.xlsx");
// Create a new workbook
var workbook = Workbook()
// Add a new worksheet to the workbook. The worksheet will be inserted into the end of the existing worksheet collection.
workbook.worksheets.add()
//Add a new worksheet to the specified position in the collection of worksheets.
workbook.worksheets.addBefore(workbook.worksheets.get(0))
workbook.worksheets.addAfter(workbook.worksheets.get(1))
//Set worksheet's name.
workbook.worksheets.get(2).name = "Product Plan"
// Save to an excel file
workbook.save("AddWorksheet.xlsx")