0% found this document useful (0 votes)
6 views5 pages

Python Project Report

The document outlines a Python project for managing student records using Excel, detailing its objective, algorithm, and flowchart. It describes the program's functionality, including creating, reading, and updating a spreadsheet with student data such as Roll Number, USN, Name, Marks, and Percentage. The project utilizes the openpyxl library and provides a step-by-step breakdown of the code implementation.

Uploaded by

mdsaeedbagayat28
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

Python Project Report

The document outlines a Python project for managing student records using Excel, detailing its objective, algorithm, and flowchart. It describes the program's functionality, including creating, reading, and updating a spreadsheet with student data such as Roll Number, USN, Name, Marks, and Percentage. The project utilizes the openpyxl library and provides a step-by-step breakdown of the code implementation.

Uploaded by

mdsaeedbagayat28
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Python Project Report

Title of the Project


Student Record Management Using Excel in Python

Objective
To develop a simple Python program that creates a spreadsheet to store student records
including Roll Number, USN, Name, Marks of three subjects, and Percentage. The program
also allows reading and updating (adding new student details) of the spreadsheet.

Algorithm
1. Import the required module (openpyxl).
2. Create a new Excel file and add column headers.
3. Add one student’s details and calculate the percentage.
4. Save the file.
5. Read the data from the file and display it.
6. Add another student's details and update the file.
7. Read the updated data again and display it.

Flowchart
[START]
|
v
[Import openpyxl]
|
v
[Create Workbook]
|
v
[Add Headers and Student Data]
|
v
[Save to students.xlsx]
|
v
[Read and Display Data]
|
v
[Add New Student]
|
v
[Save and Display Again]
|
v
[END]

Explanation

🔧 Tools Used
 Python programming language
 openpyxl library to handle Excel files

🧠 What the Program Does


This Python program:
1. Creates a new Excel file (students.xlsx) to store student details.
2. Adds student data including Roll No, USN, Name, Marks for 3 subjects, and calculates
the Percentage.
3. Reads the data from the spreadsheet and displays it.
4. Updates the spreadsheet by adding a new student entry.

🪜 Step-by-step Breakdown
✅ 1. create_file()
 Creates a new Excel file.
 Adds column headers like Roll No, USN, Name, Marks1, Marks2, Marks3, and
Percentage.
 Inserts one student’s record (e.g., John with marks 80, 85, 90).
 Calculates percentage as the average of 3 marks.
 Saves the Excel file.
✅ 2. read_file()
 Opens the existing Excel file (students.xlsx).
 Reads and prints all the data row by row.
✅ 3. add_student()
 Reopens the existing file.
 Adds a second student’s data (e.g., Amina with marks 75, 80, 70).
 Again, percentage is calculated as the average.
 Saves the updated file.
✅ 4. Execution Flow
 Calls create_file() → Creates file and saves 1st student.
 Calls read_file() → Shows saved student.
 Calls add_student() → Adds 2nd student.
 Calls read_file() again → Shows updated student list.

📄 Why It's Useful


 Helps in managing student data in a structured way using Excel.
 Simple and beginner-friendly example of working with files and external libraries in
Python.
 Demonstrates reading, writing, and updating Excel sheets programmatically.
Program Code:
from openpyxl import workbook,load_workbook
def create_file()
wb = workbook()
ws = wb.active
ws.append(["Roll No", "USN", "Name", "Marks1", "Marks2", "Marks3",
"Percentage"]) m1, m2, m3 = 80, 85, 90
percentage = (m1 + m2 + m3) / 3
ws.append([1, "USN001", "John", m1, m2, m3, percentage])
wb.save("students.xlsx")
print("File created successfully.")

def read_file():
wb =
load_workbook("students.xlsx") ws =
wb.active
print("\nStudent Records:")
for row in ws.iter_rows(values_only=True):
print(row)

def add_student():
wb =
load_workbook("students.xlsx") ws =
wb.active
m1, m2, m3 = 75, 80, 70
percentage = (m1 + m2 + m3) / 3
ws.append([2, "USN002", "Amina", m1, m2, m3, percentage])
wb.save("students.xlsx")
print("New student added successfully.")

create_file()
read_file()
add_student()
print("\nAfter adding new student:")
read_file()
Output

You might also like