Sep-18-2017, 10:38 AM
I have a results sheet from a multiple choice marking program. I only need to check if there is no content in a particular cell.
Lets say we are looking at column F of an excel table. Each row from row 2 to sheet.max_row should have an entry, a letter from A, B, C or D. These letters are assigned by a program which marks multiple choice forms.
What I am looking for is cells which have no entry.
In this example, F5 has no content. So I will assign the student number in B5 to studentNumbersWithErrors[]
What I want is to find any cells in all even columns from F onwards which have no content. If there is no content, I want the student number, which is in column B. The row is rowNum. Then I can check in the marking program to see what the problem is. That way, I only need to check if there is a problem.
I've tried:
I keep getting 'syntax error'. Any tips please?
Lets say we are looking at column F of an excel table. Each row from row 2 to sheet.max_row should have an entry, a letter from A, B, C or D. These letters are assigned by a program which marks multiple choice forms.
What I am looking for is cells which have no entry.
for rowNum in range(2, sheet.max_row): print(sheet.cell(row=rowNum, column=6).value)This output looks like this:
Quote:D
C
B
None
D
A
A
In this example, F5 has no content. So I will assign the student number in B5 to studentNumbersWithErrors[]
What I want is to find any cells in all even columns from F onwards which have no content. If there is no content, I want the student number, which is in column B. The row is rowNum. Then I can check in the marking program to see what the problem is. That way, I only need to check if there is a problem.
I've tried:
Quote:if sheet.cell(row=rowNum, column=6).value = 'None':
if sheet.cell(row=rowNum, column=6).value = None:
if sheet.cell(row=rowNum, column=6).value = '':
I keep getting 'syntax error'. Any tips please?