-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
36 lines (25 loc) · 925 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import openpyxl
from openpyxl.styles import PatternFill
def getRowCount(file, sheetName):
wb = openpyxl.load_workbook(file)
sheet = wb[sheetName]
return sheet.max_row
def getColumnCount(file, sheetName):
wb = openpyxl.load_workbook(file)
sheet = wb[sheetName]
return sheet.max_column
def readData(file, sheetName, rowNum, colNum):
wb = openpyxl.load_workbook(file)
sheet = wb[sheetName]
return sheet.cell(rowNum, colNum).value
def writeData(file, sheetName, rowNum, colNum, data):
wb = openpyxl.load_workbook(file)
sheet = wb[sheetName]
sheet.cell(rowNum, colNum).value = data
wb.save(file)
def fillGreenColor(file, sheetName, rowNum, colNum):
wb = openpyxl.load_workbook(file)
sheet = wb[sheetName]
greenFill = PatternFill(start_color="60b212", end_color="60b212", fill_type='solid')
sheet.cell(rowNum,colNum).fill = greenFill
wb.save(file)