Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
To add worksheets to a new Excel file using Aspose.Cells for Java in Jython, see the example code below.
Jython Code
from aspose-cells import Settings
from com.aspose.cells import Workbook
from com.aspose.cells import SaveFormat
class AddingWorksheetstoNewExcelFile:
def __init__(self):
dataDir = Settings.dataDir + 'WorkingWithWorksheets/AddingWorksheetstoNewExcelFile/'
workbook = Workbook(dataDir + "Book1.xls")
# Adding a new worksheet to the Workbook object
worksheets = workbook.getWorksheets()
sheetIndex = worksheets.add()
worksheet = worksheets.get(sheetIndex)
# Setting the name of the newly added worksheet
worksheet.setName("My Worksheet")
# Saving the Excel file
workbook.save(dataDir + "book.out.xls")
# Print message
print "Sheet added successfully."
if __name__ == '__main__':
AddingWorksheetstoNewExcelFile()Download the code for Adding Worksheets to a New Excel File (Aspose.Cells) from any of the social coding sites listed below:
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.