-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (22 loc) · 885 Bytes
/
main.py
File metadata and controls
30 lines (22 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""
Spreadsheet Automation Demo
A simple Python script demonstrating Excel file processing with pandas.
"""
import pandas as pd
def process_spreadsheet(input_file: str = "data.xlsx", output_file: str = "output.xlsx") -> None:
"""
Read an Excel file, process the data, and save the results.
Args:
input_file: Path to the input Excel file
output_file: Path for the output Excel file
"""
# Read the Excel file into a pandas DataFrame
df = pd.read_excel(input_file)
# Process rows: convert names to uppercase (if 'name' column exists)
if "name" in df.columns:
df["name"] = df["name"].astype(str).str.upper()
# Save the processed data to a new Excel file
df.to_excel(output_file, index=False)
print(f"Processed {len(df)} rows. Results saved to {output_file}.")
if __name__ == "__main__":
process_spreadsheet()