45 lines
1.4 KiB
Python
45 lines
1.4 KiB
Python
import pandas as pd
|
|
|
|
# Read all sheets from the ODS file
|
|
ods_file = 'Interactive_Training_Plans.xlsx'
|
|
all_sheets = pd.read_excel(ods_file, sheet_name=None, skiprows=range(4))
|
|
|
|
# Iterate through the sheets and print their names and contents
|
|
# for sheet_name, df in all_sheets.items():
|
|
# print(f"Sheet: {sheet_name}")
|
|
# print(df.head())
|
|
# print("\n")
|
|
|
|
# Iterate through the sheets and print their names
|
|
# for sheet_name in all_sheets.keys():
|
|
# if 'Level 5 | 7 sessions | 18 weeks' in sheet_name:
|
|
# print(f"Sheet name: {sheet_name}")
|
|
|
|
# Return one sheet
|
|
|
|
# Assuming 'df' is your DataFrame
|
|
week = 9
|
|
session_column = "Session 3"
|
|
|
|
for sheet_name, df in all_sheets.items():
|
|
if 'Level 5 | 7 sessions | 18 weeks' in sheet_name:
|
|
print(f"Sheet name: {sheet_name}")
|
|
print(df.to_string())
|
|
print("\n")
|
|
#
|
|
# Print available columns
|
|
print("Available columns:", df.columns.tolist())
|
|
|
|
# Check if 'Week' column exists
|
|
if 'Week' in df.columns:
|
|
# Find the row corresponding to week 9
|
|
week_row = df[df["Week"] == week]
|
|
|
|
# Get the value in the "Session 3" column for week 9
|
|
value = week_row[session_column].values[0]
|
|
|
|
print(f"The value for Session 3 in week {week} is: {value}")
|
|
else:
|
|
print("The 'Week' column does not exist in the DataFrame.")
|
|
print("Please specify a valid column name.")
|