Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import tkinter
- from tkinter import filedialog
- from openpyxl import load_workbook
- def thecloser(n):
- if n == "exit":
- sys.exit(0)
- else:
- print("Type exit to close this window!")
- thecloser(input())
- def main():
- root = tkinter.Tk()
- root.withdraw()
- print("Are you ready? press any key! -- :::::Program By Jerson Abraham:::::")
- input()
- Afile = filedialog.askopenfilename(initialdir="/", title="Select file",
- filetypes=(("xlsx files", "*.xlsx"), ("all files", "*.*")))
- Cfile = filedialog.askopenfilename(initialdir="/", title="Select file",
- filetypes=(("xlsx files", "*.xlsx"), ("all files", "*.*")))
- Bfile = filedialog.askopenfilename(initialdir="/", title="Select file",
- filetypes=(("xlsx files", "*.xlsx"), ("all files", "*.*")))
- print("Loading Excel Files... This may take some time!")
- Afilebook = load_workbook(Afile)
- Afile = Afilebook.active
- Cfile = load_workbook(Cfile)
- Cfile = Cfile.active
- Bfile = load_workbook(Bfile)
- Bfile = Bfile.active
- print("Loading Done!! Processing your work!!")
- for Afilecell in Afile['C']:
- if Afilecell.value is not None:
- for Bfilecell in Bfile['H']:
- if Bfilecell.value is not None:
- if Afilecell.value in Bfilecell.value:
- Afile.cell(row=Afilecell.row, column=27).value = Bfile.cell(row=Bfilecell.row, column=50).value
- Afile.cell(row=Afilecell.row, column=28).value = Bfile.cell(row=Bfilecell.row, column=51).value
- Afile.cell(row=Afilecell.row, column=29).value = Bfile.cell(row=Bfilecell.row, column=52).value
- Afile.cell(row=Afilecell.row, column=30).value = Bfile.cell(row=Bfilecell.row, column=53).value
- Afile.cell(row=Afilecell.row, column=31).value = Bfile.cell(row=Bfilecell.row, column=54).value
- Afile.cell(row=Afilecell.row, column=32).value = Bfile.cell(row=Bfilecell.row, column=55).value
- Afile.cell(row=Afilecell.row, column=33).value = Bfile.cell(row=Bfilecell.row, column=56).value
- Afile.cell(row=Afilecell.row, column=34).value = Bfile.cell(row=Bfilecell.row, column=57).value
- Afile.cell(row=Afilecell.row, column=35).value = Bfile.cell(row=Bfilecell.row, column=58).value
- for Cfilecell in Cfile['B']:
- if Cfilecell.value is not None:
- if Afilecell.value in Cfilecell.value:
- Afile.cell(row=Afilecell.row, column=20).value = Cfile.cell(row=Cfilecell.row, column=40).value
- Afile.cell(row=Afilecell.row, column=21).value = Cfile.cell(row=Cfilecell.row, column=41).value
- Afile.cell(row=Afilecell.row, column=22).value = Cfile.cell(row=Cfilecell.row, column=42).value
- Afile.cell(row=Afilecell.row, column=23).value = Cfile.cell(row=Cfilecell.row, column=43).value
- Afile.cell(row=Afilecell.row, column=24).value = Cfile.cell(row=Cfilecell.row, column=44).value
- Afile.cell(row=Afilecell.row, column=25).value = Cfile.cell(row=Cfilecell.row, column=45).value
- Afile.cell(row=Afilecell.row, column=26).value = Cfile.cell(row=Cfilecell.row, column=46).value
- print("Processing Done! File will Saved as output.xlsx")
- Afilebook.save('output.xlsx')
- print("All Done! Type exit to close this window!")
- thecloser(input())
- try:
- main()
- except Exception as e:
- print(e)
- print("Type exit to close this window!")
- thecloser(input())
Add Comment
Please, Sign In to add comment