I am relatively new to python, and have tried a couple different methods I have seen throughout this website, but nothing seems to work with what I need.
I have an excel file, with two columns of information, and multiple sheets. I would like to add a column to each of these sheets with the header "System". Under the header I need to have all the cells in sheet 1 fill with "System 1" and for sheet 2 "System 2". Each sheet has a different amount of entries, and all are over 1000.
At the end I want to merge all the sheets together making one master file, which I was able to figure out, but I can seem to add a column to the individual sheets. Below is the code I have so far:
import pandas as pd
import openpyxl
import pprint
fileName= input("Enter file name here (Case Sensitve) > ")
df = pd.read_excel(fileName +'.xlsx', sheetname=None, ignore_index=True)
xl = pd.ExcelFile(fileName +'.xlsx')
df1 = pd.read_excel(xl, 'System 1')
df2 = pd.read_excel(xl, 'System 2')
df3 = pd.read_excel(xl, 'System 3')
df4 = pd.read_excel(xl, 'System 4')
df5 = pd.read_excel(xl, 'System 5')
The excel document looks along the lines of this:
employee_number email
7000 test1@test.com
11552 test2@test.com
21356 test3@test.com
21365 test4@test.com
22022 test5@test.com
24280 test6@test.com
26279 test7@test.com
there are 5 sheets within one document that resemble this.