We are collecting result of 3rd semester b-tech(2019) from biet jhansi.(BIET RESULT)
To Get data from excel we will use 'pandas' library.
import pandas as pd
data = pd.read_excel('IT-2nd.xlsx')
Using 'xlwt' library we create a Excel workbook--
from xlwt import Workbook
wb = Workbook()
sheet1 = wb.add_sheet('IT')
sheet1.write(0, 0, 'ROLL NO')
sheet1.write(0, 1, 'NAME')
sheet1.write(0, 12, 'YGPA')
sheet1.write(0, 13, 'TOTAL')
sheet1.write(0, 14, 'PERCENTAGE')
We will add remaining columns depending upon subjects.
After this, we will launch chrome and open our required website.
from selenium import webdriver
driver = webdriver.Chrome('F:\Applications\chromedriver.exe')
driver.set_window_size(1400,1000)
driver.get('http://www.bietjhs.ac.in/result2019/GetResultodd.aspx')
We will be getting data from web-site with selenium library and write it back to Excel file. And save it
To sort the result we will again read the excel file using pandas and sort the result.
import pandas
df = pd.read_excel('Marks.xlsx')
df = df.replace(np.nan, 0)
df = df.sort_values('PERCENTAGE', ascending = False)
Then we will delete old unsorted excel file
import os
os.remove("Marks.xlsx")
Then we will save the new worksheet with sorted data
from pandas import ExcelWriter
df.to_excel('Marks.xlsx', sheet_name = 'IT',index=False, engine='xlsxwriter')