I've already written a Python script that writes something into an existing Excel list (openpyxl). I need to develop a web application, after a button has been clicked the right Python script must running. I use a server and program on a Windows computer. I would appreciate any help.
Running Python scripts with Xampp --> done it already.
I don't need any output on the website, I just want the .py file to be executed, i.e. written to my Excel file.
This is my .php Code:
<?php
exec('python C:/xampp/htdocs/QMPlan/EU_YES.py');
?>
This is my .py Code:
#!C:/Users/'myUser'/AppData/Local/Programs/Python/Python39/python.exe
import openpyxl
book = openpyxl.load_workbook('ISSDDE.xls')
sheet = book.get_sheet_by_name("General Description")
sheet['B9'] = "Yes"
book.save('ISSDDE.xls')
chmod +x EU_YES.pyis not valid Python.chmodanything since you're not attempting to run things as executables. The "Run Python with Xampp" instructions you have are a red herring here, as you're okay running the Python script via PHP.