you save wb object (i.e. excel xlsx file) with docx extension. How you expect it to open without error?
the correct approach would be to work with docx file/template and eventually transfer data from excel to word file to create the invoice
Problem 2, however note that copy file with wrong extension is just problematic
the correct approach would be to work with docx file/template and eventually transfer data from excel to word file to create the invoice
Problem 2, however note that copy file with wrong extension is just problematic
import os src_path = r'C:\Users\Ron McMillan\Desktop\demo1.xlsx' src_file = os.path.join(src_path, 'demo1.xlsx') dest_file = os.path.join(src_path, f'{new_invoice_number}.docx') print(dest_file) copyfile(src_file, dest_file)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs