I want to assign the value of the variable game_type to excel cell but i am unable to do so:
import openpyxl
wb = openpyxl.load_workbook('Table1.xlsx')
Card13 = wb.active
print Card13
class private_table():
def __init__(self, game):
if game == 13:
game_type = game
Card13['A2'] = game_type
wb.save('Table1.xlsx')
print(game_type)
elif game == '21':
game_type = int(game)
print(game_type)
elif game == '27':
game_type = int(game)
print(game_type)
else:
print("Enter correct game type")
def noc(self, cards):
if cards == 13:
game_type = Card13['A2'].value
if game_type == '13':
num_of_cards = cards
print num_of_cards
return num_of_cards
else:
print ("Please select the correct number of cards")
return("Please select the correct number of cards")
elif cards == '21':
game_type = Card13['B1'].value
if game_type == '21':
num_of_cards = cards
print num_of_cards
return num_of_cards
else:
print ("Please select the correct number of cards")
return("Please select the correct number of cards")
elif cards == '27':
game_type = Card13['B1'].value
if game_type == '27':
num_of_cards = cards
print num_of_cards
return num_of_cards
else:
print ("Please select the correct number of cards")
return("Please select the correct number of cards")