Excel sheet
import win32com.client
Create an instance of Excel
excel = win32com.client.Dispatch("Excel.Application")
Make Excel visible (optional)
excel.Visible = True
Open the workbook (change the path to your workbook)
workbook = excel.Workbooks.Open(r"C:\path\to\your\workbook.xlsx")
Iterate through each sheet in the workbook
for sheet in workbook.Sheets:
print(f"Sheet: {sheet.Name}")
# Get the used range of the sheet
used_range = sheet.UsedRange
# Get the number of rows and columns in the used range
num_rows = used_range.Rows.Count
num_columns = used_range.Columns.Count
# Define the starting cell
start_row = 4 # Corresponding to row C4
start_col = 3 # Corresponding to column C
# Iterate through each row starting from start_row in the used range
for row in range(start_row, num_rows + 1):
# Iterate through each column starting from start_col in the used range
for col in range(start_col, num_columns + 1):
# Get the value of the cell
cell_value = used_range.Cells(row, col).Value
print(f"Row {row}, Column {col}: {cell_value}")