I did achieve it by
from openpyxl import Workbook
from openpyxl.styles import Protection
wb = Workbook()
ws = wb.active
# Write the formula
ws['A1'] = '=HYPERLINK("
https://google.com", "Click Here")'
# Apply the protection setting to the specific cell
# hidden=True: Hides formula from formula bar
# locked=True: Prevents users from editing the cell
ws['A1'].protection = Protection(hidden=True, locked=True)
# CRITICAL: This setting does nothing until protection is enabled
ws.protection.sheet = True
ws.protection.password = "your_password" # Optional
wb.save("hidden_formula.xlsx")