note: Enter a VLOOKUP in F2, mapping the headoffice in E2 to the fixed branch/officer table A2:B7.

action:
import pyautogui, time
# Go directly to the first output cell.
pyautogui.click(145,185)
pyautogui.hotkey('ctrl','a')
pyautogui.write('F2')
pyautogui.press('enter')
# Enter a VLOOKUP against the fixed branch/officer table.
pyautogui.write('=VLOOKUP(E2;$A$2:$B$7;2;0)', interval=0.03)
pyautogui.press('enter')
time.sleep(3)


note: Select F2:F12 and fill the VLOOKUP formula down so each row uses its own headoffice reference.

action:
import pyautogui, time
pyautogui.click(145,185)
pyautogui.hotkey('ctrl','a')
pyautogui.write('F2:F12')
pyautogui.press('enter')
pyautogui.hotkey('ctrl','d')
time.sleep(4)


note: Save the completed workbook in place.

action:
import pyautogui, time
pyautogui.hotkey('ctrl','s')
time.sleep(5)