Read the complete article on how to adjust row height and column width in Excel using Python: https://blog.aspose.com/cells/adjust-row-height-column-width-in-excel-python/
Last active
September 21, 2022 07:08
-
-
Save aspose-com-gists/af09ca4d792ab736163aa09d83488e85 to your computer and use it in GitHub Desktop.
Adjust Row Height and Column Width in Excel using Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jpype | |
import asposecells | |
jpype.startJVM() | |
from asposecells.api import Workbook | |
# Load Excel file | |
workbook = Workbook("source.xlsx") | |
# Access the first worksheet in the Excel file | |
worksheet = workbook.getWorksheets().get(0) | |
# Get cells collection | |
cells = worksheet.getCells() | |
# Set the height of the second column to 40 | |
cells.setColumnWidth(1, 40) | |
# Save the updated Excel file | |
workbook.save("column-adjustment.xlsx") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jpype | |
import asposecells | |
jpype.startJVM() | |
from asposecells.api import Workbook | |
# Load Excel file | |
workbook = Workbook("source.xlsx") | |
# Access the first worksheet in the Excel file | |
worksheet = workbook.getWorksheets().get(0) | |
# Get cells collection | |
cells = worksheet.getCells() | |
# Set the height of the second row to 50 | |
cells.setRowHeight(1, 50) | |
# Save the updated Excel file | |
workbook.save("row-adjustment.xlsx") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment