Basically, I am trying to loop over spreadsheet column letters in python, but I have no clue what I am doing wrong. For context the -1 on the first call is because the first letter of the alphabet is 1, not 0. I get no end, and instead, it loops at rem = 22, and the letter q. The requirements I have are that the last letter ( BXD) not be divisible by three (what the triple portion of the code focuses on). If there is a better way to do this than recursion, then I'm all ears.
Alphabet = "ABCDEFGHIJKLMNOPQRSTUVQXYZ"
def function(num):
str = ""
i = 0
while num >= 1:
if num > 26:
rem = num % 26
print("Rem ", rem)
str = str + function(rem)
else:
triple = num % 3
if triple != 0 :
print(Alphabet[num])
return Alphabet[num]
print(function(100-1))
All the pygsheets functions that take an Address will accept a label or tuple r Address object. please note that this does not have the triple logic you need.
see docs here