I have created python script that chronologically:
uses sqlalchemy library to select data from MS SQL database
engine = create_engine("mssql+pyodbc://server\database?driver=SQL Server?Trusted_Connection=yes")does some modifications to selected data and creates dataframe with employees, e-mail adresses and some additional information
uses win32com.client library to send e-mails via outlook to employees in created dataframe with some "tailor-made" information
outlook = win32.Dispatch('outlook.application')
...
for index, row in final_df.iterrows():
mail = outlook.CreateItem(0)
mail.To = row["MAIL"]
mail.SentOnBehalfOfName = "[email protected]"
mail.cc = row["MANAGER"]
mail.Subject = ...
mail.Body = ...
mail.Send()
Is it possible to deploy this kind of script on MS SQL Server? Or possibly on a network drive?
Also how con I adjust the code so it won't rely my user profile when it connects to database and when it generates e-mails?
Goal is to schedule it to run automatically on a daily basis.
You cannot run code from nowhere. If you are working at a company, request them to buy a minimal VPS (virtual private server) so it can run all the time. That is very cheap. If its for private needs buy one for yourself.