🛠️ #ExcelAutomation #PasswordSecurity #python #pythonprogramming #coding #programming #employeeengagement #python3
I remember an instance from my office, there was a problem that I saw. Every time a new employee joined the team, the office manager had to come up with a unique password for them to use. This was a tedious task, and sometimes the passwords weren’t very secure.
That day, I decided to try using Python to automate this procedure and help my office manager. I stood up to the manager and told him about what magic Python can do. With Python’s help, the office manager learned how to automate the process of generating passwords for employees in Excel. They no longer had to spend hours thinking up passwords or spend time and money on some automated software – Python could do it for them!
Using Python’s magic, I created a script for the office manager that read the list of employee names from an Excel file. Then, like a wizard casting a spell, Python conjured up random passwords for each employee, making sure they were strong and secure.
With a wave of Python’s wand, the passwords were added to the Excel file next to each employee’s name. Then office manager saved the file and opened it, marveling at how quickly and effortlessly Python had solved their problem.
From that day forward, generating employee passwords was no longer a daunting task. Thanks to Python’s automation magic, the office manager could focus on more important matters, like brewing the perfect cup of coffee for the team. And they all lived happily ever after, with secure passwords and efficient workflows, thanks to Python’s enchanting powers.
Now let me take you all through the Python script and how it becomes a magic spell
Step 1: We will first take the predefined names of some employees and then generate random passwords for them in Excel automatically.
import openpyxl
import random
import string
# Create a workbook and select the active sheet
workbook = openpyxl.Workbook()
sheet = workbook.active
# Indian employee names
employee_names = [
"Ramesh Kumar",
"Priya Patel",
"Amit Singh",
"Divya Sharma",
"Rajesh Gupta",
"Anjali Verma",
"Sanjay Tiwari",
"Neha Mishra",
"Vivek Malhotra",
"Pooja Choudhary"
]
# Fill employee names in column A with 'Employee' as header
sheet['A1'] = 'Employee'
sheet['B1'] = 'Passwords'
for index, name in enumerate(employee_names, start=2):
sheet.cell(row=index, column=1).value = name
# Function to generate passwords for each employee
def generate_passwords():
for row in range(2, sheet.max_row + 1):
password = ''.join(random.choices(string.ascii_letters + string.digits, k=8))
sheet.cell(row=row, column=2).value = password
# Call the function to generate passwords
generate_passwords()
# Save the workbook
workbook.save("employee_names.xlsx")
# Open the Excel file for editing
import os
os.system("start employee_names.xlsx")
Read More Below
Top comments (0)