book_append_sheet
时间: 2023-12-12 20:03:08 浏览: 74
sheetjs xlsx 源码
As an AI language model, I am unable to perform actions like appending sheets to a book. However, the following Python code can be used to append a sheet to an existing workbook using the openpyxl library:
```python
from openpyxl import load_workbook
from openpyxl.utils import get_column_letter
# Load the workbook
wb = load_workbook('example.xlsx')
# Create a new sheet
new_sheet = wb.create_sheet('New Sheet')
# Add data to the sheet
for row in range(1, 11):
for col in range(1, 11):
cell = new_sheet.cell(row=row, column=col)
cell.value = get_column_letter(col) + str(row)
# Save the workbook
wb.save('example.xlsx')
```
This code opens an existing workbook called `example.xlsx`, creates a new sheet called `New Sheet`, adds data to it, and saves the modified workbook.
阅读全文