I have python code that generates excel from other files, and I want to permanently incorporate photos into that code. To enable anyone to open my programme and generate an excel, I want to create an.exe file. There should be two photos in the header of this file (excel). How do I get the software or application to load the right files from the user’s computer? Because of the username and the location of the file’s storage, the path to the file may change. I’m going to presume that both of the picture files and the.exe executable file are in the same folder.
Below is the code of how it works now:
logo = Image("C:/Users/STJ2TW/Desktop/folder/logo.png") element = Image("C:/Users/STJ2TW/Desktop/folder/element.png") ws.merge_cells('A1:E3') logo.width = 500 logo.height = 120 element.width = 140 element.height = 140 element.alignment = Alignment(horizontal="left", vertical="center") ws.add_image(logo, 'A1') ws.add_image(element, 'E1')
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $200 of credit to try our products over 60 days!
I’m not sure there is a way to know the exact path every time. What you can try though are two things in my eyes.
The above would mean you need to configure only the path in the program. Since all people will have a different setup, you can just set instructions on how to configure it.
An alternative would be to set instructions for where the images need to be, in which directory.