Как видите, pd.ilo c очень мощный: df.iloc [номер строки, номер столбца]: столбцы: A, B, C, номер столбца D = 0,1,2,3
import pandas as pd
from pathlib import Path
data_folder = Path(PATH)
file_to_open = data_folder / "excelbestand.xlsx"
df = pd.read_excel(file_to_open)
num_iterations = 1
data_x = 4
i=0
##### In this while you are appending the count of column "A" to the end of column "A"
while i <= num_iterations:
df.loc[df.index.max()+1, 0] = [data_x]
i += 1
###########code for adding to las cell of column B
i2 = 0
while i2 <= num_iterations:
df.loc[df.index.max()+1,1] = [data_x]
i += 1
df.to_excel(file_to_open, index = False)