This is the code I am entering
from openpyxl import Workbook
from datetime import datetime
timestr=datetime.now().strftime("%d%m%Y-%H%M%S")
workbook = Workbook()
sheet = workbook.active
sheet["A1"]="Email"
sheet["B1"]="Password"
sheet["C1"]="Phoneno"
workbook.save("C:\Users\HARSHIL\Desktop\Proxlight-Designer-main\Backend Logs\"backend_"+timestr+"data.xlsx"")
I am able to save the file randomly in the folder where I saved my python file but i am unable to do so when i want to save it to any other folder.
This error is because you're using backslash, instead slash to the path. Try something like this:
...
workbook.save("C:/Users/HARSHIL/Desktop/Proxlight-Designer-main/Backend Logs/" + timestr + "_data.xlsx")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.