Congratulations, excellent application! Is it possible to join PDF sheets in a specific order? I used your application but when I joined the PDF sheets the one I wanted to be sheet number 2 was number 17.
Thank you very much for watching the video. I am glad you like the solution. The 'append' method will just append the pdf to the end. Meaning, the order is then defined by the order you will get back from the 'pdf_files' list: pdf_files = list(Path(source_dir).glob("*.pdf")) One option could be to reorder the list before using it in the for-loop. Example: pdf_files = list(Path(source_dir).glob("*.pdf")) # Let's assume you have 5 pdf files in the folder myorder = [3, 2, 0, 1, 4] pdf_files= [pdf_files[i] for i in myorder] Alternatively, you can also use the 'merge' method, which merges the pages from the given file into the output file at the specified page number. Here is the documentation: pythonhosted.org/PyPDF2/PdfFileMerger.html#PyPDF2.PdfFileMerger.merge Hope this helps!
Thank you for watching the video. I do not have a mac available to test the code. Yet, xlwings and the containing VBA code should be also working on mac os.
Sir, I made executable file. Then the foll code is to be placed in module1 Sub MySample() RunFrozenPython "F:\Currentwork\PDFmerge\pdfmerger.exe", "arg1 arg2" End Sub Here my both files excel and pdfmerger.exe is in F drive in above said path. What is arg1 and arg2 I dont know? I am not getting my combined file
Thank you! Yes, it should be possible. I got some inspiration from the following StackOverflow post: stackoverflow.com/questions/3984003/how-to-extract-pdf-fields-from-a-filled-out-form-in-python ... and created the following example for you: 👉 drive.google.com/file/d/1jjprU34kPWhJ-BJL3-wmvRPSiqtErS4r/view?usp=sharing The script will get the values from the PDF Form. You can then add those values to your preferred database. Hope it helps 🙏 Cheers, Sven ✌
Hi Alexandre, In my lunch break, I shortly extended my previous example. The script will now loop over any given folder, get only pdf files, get the values from the fields and export the result to Excel. You can find the updated example here: drive.google.com/file/d/16b_gx4iU3AOIekwYEG_6OaIu4Yao6M0F/view?usp=sharing Hope it gives you a good starting point for your individual project. If you need any support, please let me know. Thank you.
Dear Sir without installing python we can't use We need to only excel vba using to compile all pdf in single file it is possible sir Kindly your advise
Spot on! This solution uses Python. For doing something similar in VBA, check out the following video: th-cam.com/video/2GjPjc-Jtvs/w-d-xo.html Happy Coding!
Hey, great video. Can you post all of the code for the Sub SampleCall()? It's cut off in the view and I'm having some issues with the code in that sub.
Thanks for watching. I have uploaded the files incl. the workbook (with the VBA code) to GitHub. Please find it here: github.com/Sven-Bo/merge-pdf-files-in-excel
Thank you for watching the video. No, that is not possible. You could, however, convert the .py file to a standalone executable file (.exe) using 'pyinstaller'. Once converted, you can execute the .exe file from VBA. Hope this helps! :)
Thanks for watching the video. No, you could also use VBA for this. 'VBAA2Z' has a great video on how to merge pdf files using VBA: th-cam.com/video/2GjPjc-Jtvs/w-d-xo.html
Unhide the hidden worksheet, remove the leading underscore _ from the sheet name and set showConsole to False: docs.xlwings.org/en/latest/addin.html#workbook-config-xlwings-conf-sheet
You reply to every one questions, that’s so great sir. Really appreciate you. Sir I got where my mistake is. I have one more question if I want to share this excel file to pc where no python is installed,then by .python executable file I have to share, but along with it does this excel file also has to be shared.?
@@myfav7570 How did you manage to resolve your issue? Sharing your solution here could be really helpful for others who might face the same problem. Regarding your question, if the other device doesn't have Python installed, you'll need to convert your Python script into a standalone executable file. After that, you can run the file using the xlwings VBA module. For more details, check out this link: docs.xlwings.org/en/0.30.2/deployment.html
@@CodingIsFun Sir Thank you for your reply. First of all my issue got resolved because i did not followed properly the first step of quickstart----- so My code did not ran properly. Next sir now my code is running properly, but in start i am getting cmd screen -- how to avoid this. Secondly , I am not getting output name as I am specifying in excel sheet & the file is genered in name "output_name" and also not getting ".pdf" extension to it. so i have to right click and select open with acrobat reader... Hope I am able to convey my problem.
SIr I have to change my code little bit because it gave me error. I am writing my code here.from PyPDF2 import PdfMerger, PdfReader , It gave me error if I wrote" PdfFileMerger", "PdfFIleReader". Also at this line of code [output_name=sheet.range('output_name').value+'.pdf'] the output_name is greyed out and while hovering over it says "output_name" is not accessed by Pylance. Please guide me. Thank you
@@analyticsadda6080 I receive many requests for creating individual solutions. As much as I want to help, I simply do not find the time in my daily schedule to develop & test all the different requests. I hope you can understand. Thank you!
Im getting an error at the very beginning: --------------------------- Error --------------------------- Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases. Press Ctrl+C to copy this message to the clipboard. --------------------------- OK ---------------------------
@@CodingIsFun yeah already installed main anaconda not miniconda-- installed miniconda again and it worked! Just wondering if you know how to get python in an existing pdf file ?
@@CodingIsFun I'm sorry -- so basically I have a user form doing many different things and I want it to combine pdfs as an extra feature. I just wanted to know how to allow python to work with an existing excel file in order to build this in
@@vishnupeteti8408 Alright, you might want to check out the following video: th-cam.com/video/iIATJtruZBE/w-d-xo.html In the video, I am covering different scenarios on how to combine Excel with Python. I hope this helps! Happy Coding! :)
I am get below mentioned Error: --------------------------- Error --------------------------- Traceback (most recent call last): File "", line 1, in File "c:\users\sathikraja.segu\pdfmerger\pdfmerger.py", line 3, in from PyPDF2 import PdfFileMerger, PdfFileReader ModuleNotFoundError: No module named 'PyPDF2' Press Ctrl+C to copy this message to the clipboard. --------------------------- OK --------------------------- Kindly help me
Thanks for teaching pythons
Most welcome 😊 Thanks for watching the video 👍
Congratulations, excellent application! Is it possible to join PDF sheets in a specific order? I used your application but when I joined the PDF sheets the one I wanted to be sheet number 2 was number 17.
Thank you very much for watching the video. I am glad you like the solution. The 'append' method will just append the pdf to the end. Meaning, the order is then defined by the order you will get back from the 'pdf_files' list: pdf_files = list(Path(source_dir).glob("*.pdf"))
One option could be to reorder the list before using it in the for-loop. Example:
pdf_files = list(Path(source_dir).glob("*.pdf")) # Let's assume you have 5 pdf files in the folder
myorder = [3, 2, 0, 1, 4]
pdf_files= [pdf_files[i] for i in myorder]
Alternatively, you can also use the 'merge' method, which merges the pages from the given file into the output file at the specified page number. Here is the documentation:
pythonhosted.org/PyPDF2/PdfFileMerger.html#PyPDF2.PdfFileMerger.merge
Hope this helps!
Great Tutorial
Glad you like it!
Awesome. Thanks a lot.
*A pleasure, thanks for watching!*
Thanks for the tutorial! What modifications need to be done to module/vba in mac system?
Thank you for watching the video. I do not have a mac available to test the code. Yet, xlwings and the containing VBA code should be also working on mac os.
Sir, I made executable file. Then the foll code is to be placed in module1
Sub MySample()
RunFrozenPython "F:\Currentwork\PDFmerge\pdfmerger.exe", "arg1 arg2"
End Sub
Here my both files excel and pdfmerger.exe is in F drive in above said path.
What is arg1 and arg2 I dont know?
I am not getting my combined file
Thanks for watching and for your question. Hard to tell from a distance why you are facing an error. Sorry that I cannot help.
Great video. It makes me wonder if It's possible to detect and extract fields in a standardized pdf file and add it to a database?
Thank you!
Yes, it should be possible.
I got some inspiration from the following StackOverflow post:
stackoverflow.com/questions/3984003/how-to-extract-pdf-fields-from-a-filled-out-form-in-python
... and created the following example for you:
👉 drive.google.com/file/d/1jjprU34kPWhJ-BJL3-wmvRPSiqtErS4r/view?usp=sharing
The script will get the values from the PDF Form. You can then add those values to your preferred database.
Hope it helps 🙏
Cheers,
Sven ✌
Hi Alexandre,
In my lunch break, I shortly extended my previous example.
The script will now loop over any given folder, get only pdf files, get the values from the fields and export the result to Excel.
You can find the updated example here:
drive.google.com/file/d/16b_gx4iU3AOIekwYEG_6OaIu4Yao6M0F/view?usp=sharing
Hope it gives you a good starting point for your individual project. If you need any support, please let me know.
Thank you.
@@CodingIsFun thank you very much Sven! Really appreciate it!
@@alecouto I'm happy to help.
Dear Sir without installing python we can't use
We need to only excel vba using to compile all pdf in single file it is possible sir
Kindly your advise
Spot on! This solution uses Python. For doing something similar in VBA, check out the following video:
th-cam.com/video/2GjPjc-Jtvs/w-d-xo.html
Happy Coding!
Hey, great video. Can you post all of the code for the Sub SampleCall()? It's cut off in the view and I'm having some issues with the code in that sub.
Thanks for watching. I have uploaded the files incl. the workbook (with the VBA code) to GitHub. Please find it here: github.com/Sven-Bo/merge-pdf-files-in-excel
File error file new
Hi
Can I ask if this application can be run on a computer that does not have python installed?
Thank you so much.
Thank you for watching the video. No, that is not possible. You could, however, convert the .py file to a standalone executable file (.exe) using 'pyinstaller'. Once converted, you can execute the .exe file from VBA. Hope this helps! :)
@@CodingIsFun Great! Thanks for help me ^.^
Hi,
Can we do this using only VBA? Without using python?
Thanks for watching the video. No, you could also use VBA for this.
'VBAA2Z' has a great video on how to merge pdf files using VBA:
th-cam.com/video/2GjPjc-Jtvs/w-d-xo.html
Sir whenever I click merge button first cmd screen pops up : how to resolve this issue
Unhide the hidden worksheet, remove the leading underscore _ from the sheet name and set showConsole to False: docs.xlwings.org/en/latest/addin.html#workbook-config-xlwings-conf-sheet
@@CodingIsFun sir it worked, only I have to remove underscore. Because it was originally set to false only.
Thank you sir
Sir , in my excel the code stops at RunPython , i did everything as per video. Do i have to install xlwings addin
Thanks for watching and for your question. Hard to tell from a distance why you are facing an error. Sorry that I cannot help.
You reply to every one questions, that’s so great sir. Really appreciate you.
Sir I got where my mistake is.
I have one more question if I want to share this excel file to pc where no python is installed,then by .python executable file I have to share, but along with it does this excel file also has to be shared.?
@@myfav7570 How did you manage to resolve your issue? Sharing your solution here could be really helpful for others who might face the same problem.
Regarding your question, if the other device doesn't have Python installed, you'll need to convert your Python script into a standalone executable file. After that, you can run the file using the xlwings VBA module. For more details, check out this link: docs.xlwings.org/en/0.30.2/deployment.html
@@CodingIsFun Sir Thank you for your reply. First of all my issue got resolved because i did not followed properly the first step of quickstart-----
so My code did not ran properly.
Next sir now my code is running properly, but in start i am getting cmd screen -- how to avoid this. Secondly , I am not getting output name as I am specifying in excel sheet & the file is genered in name "output_name" and also not getting ".pdf" extension to it. so i have to right click and select open with acrobat reader...
Hope I am able to convey my problem.
SIr I have to change my code little bit because it gave me error. I am writing my code here.from PyPDF2 import PdfMerger, PdfReader , It gave me error if I wrote" PdfFileMerger", "PdfFIleReader". Also at this line of code [output_name=sheet.range('output_name').value+'.pdf'] the output_name is greyed out and while hovering over it says "output_name" is not accessed by Pylance. Please guide me. Thank you
Can you teach how to convert excel Report to pdf?
Thanks for watching. Here is an example: stackoverflow.com/a/71978652
great work thx
and pls how to do the opposite
Thanks for watching. Have a look here: stackoverflow.com/a/490203
Happy Coding!
@@CodingIsFun Thank u so much 🙏
I love this but I want to do this with VBA not using python.
Thank you for watching the video & your suggestion.
@@CodingIsFun How can I do this with VBA.
@@analyticsadda6080 I receive many requests for creating individual solutions. As much as I want to help, I simply do not find the time in my daily schedule to develop & test all the different requests. I hope you can understand. Thank you!
Im getting an error at the very beginning:
---------------------------
Error
---------------------------
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
Press Ctrl+C to copy this message to the clipboard.
---------------------------
OK
---------------------------
Have you already installed Python?
@@CodingIsFun yeah already installed main anaconda not miniconda-- installed miniconda again and it worked!
Just wondering if you know how to get python in an existing pdf file ?
@@vishnupeteti8408 Can you perhaps elaborate on what it is you're actually trying to achieve?
Please provide some additional info. Thanks!
@@CodingIsFun I'm sorry -- so basically I have a user form doing many different things and I want it to combine pdfs as an extra feature.
I just wanted to know how to allow python to work with an existing excel file in order to build this in
@@vishnupeteti8408 Alright, you might want to check out the following video:
th-cam.com/video/iIATJtruZBE/w-d-xo.html
In the video, I am covering different scenarios on how to combine Excel with Python.
I hope this helps! Happy Coding! :)
I am get below mentioned Error:
---------------------------
Error
---------------------------
Traceback (most recent call last):
File "", line 1, in
File "c:\users\sathikraja.segu\pdfmerger\pdfmerger.py", line 3, in
from PyPDF2 import PdfFileMerger, PdfFileReader
ModuleNotFoundError: No module named 'PyPDF2'
Press Ctrl+C to copy this message to the clipboard.
---------------------------
OK
---------------------------
Kindly help me
Have you installed the required dependency PyPDF as shown in the video? Thanks!