'My code overwrites data into one cell in excel if more than two users input their data

Currently, I'm using pyTelegramBotAPI to make a bot. Everything worked well when it came to writing some input data from one user into the empty cell.

But the chaos started when more than two users used the bot at the same time. Their data literally was written over each others.

i = 1
name = message.text
al = ws_ishchi[f'F{i}'].value
while str(al) != "None":
    i += 1
    al = ws_ishchi[f'F{i}'].value
alo = ws_ishchi[f'F{i}']
alo.value = name

So as you see my code first finds an empty cell and only then starts writing data into it. But in a situation with two users when both of them sent the data in the same data it got ovewritten by each other.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source