Stephen Codes
Stephen Codes
  • 6
  • 18 037
Creating pictures in Excel using worksheet cells.
In this video we will use a script that creates/draw pictures in Excel using only the cells (no inserting images).
GitHub link: github.com/steve-codes/picture-to-excel
Excel limitations document: support.microsoft.com/en-us/office/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3
Chapters:
0:00 Intro
0:12 Explaining idea
1:04 Running code
2:20 Code review
9:18 Conclusion
มุมมอง: 62

วีดีโอ

Using Python to automate data entry for a website (web bot)
มุมมอง 7Kปีที่แล้ว
In this video, we will create a web bot to enter data from an excel file into a website using the python library selenium. This is the most extensive video I've made so far and the code may seem a bit complicated. I tried my best to explain my process, but I can re-create the process in a mini-series if enough people request it (in the hopes of explaining it more clearly). GitHub link: github.c...
PYTHON: Renaming PDFs using an Excel file and splitting PDF pages
มุมมอง 8332 ปีที่แล้ว
Just a note: a good rule of thumb is to backup your data before making changes to it. If you have a lot of files to change; BACK THEM UP. In this tutorial, we explain how to rename PDFs using an Excel file and also how to split PDFs (moving pages into new PDFs). Code: github.com/steve-codes/Splitting-and-Renaming-PDFs-using-Excel Chapters: 00:00 Intro 00:12 Objective 00:45 Requirments 01:00 Pro...
Python: Renaming PDFs using text inside a document with regex
มุมมอง 2.1K2 ปีที่แล้ว
In this tutorial, we expand on renaming PDFs using regular expressions (regex). This is one of the many examples of using regex, if you have different requirements it will require a different regex expression. I have posted a written explanation of the regular expression used in the video on GitHub. Code (pdf_regex branch): github.com/steve-codes/PDF-rename-V2/tree/pdf_regex Regex101: regex101....
Rename PDFs using text content from a document (PYTHON)
มุมมอง 6K2 ปีที่แล้ว
This tutorial is a response to a comment on the last video asking how you would rename a PDF using the title of the file which is located inside the PDF we are trying to rename. If you would like another tutorial request it in the comments and I will try and get back Github: github.com/steve-codes/PDF-rename-V2 Last video: th-cam.com/video/MkXEfzQMmQ8/w-d-xo.html
Changing PDF file names using python
มุมมอง 1.7K3 ปีที่แล้ว
In today's video I'll show you have to programmatically rename multiple pdf files using python. Github: github.com/steve-codes/python-fileRename

ความคิดเห็น

  • @LearningWithMe
    @LearningWithMe 4 หลายเดือนก่อน

    Thanks pro but I try to make one on my website but there is a lot of error can you help me, please give me your email

  • @MrDwaynecasey
    @MrDwaynecasey 5 หลายเดือนก่อน

    Nice! I just want to check one field - project numbers - and print the result like make a report. Looks doable 🤓

  • @kevindarsono185
    @kevindarsono185 9 หลายเดือนก่อน

    can u help me, error 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell' is denied. To change the execution policy for the default (LocalMachine) scope, start Windows PowerShell with the "Run as administrator" option.

    • @stephencodes
      @stephencodes 8 หลายเดือนก่อน

      It looks like you are trying to run a powershell script but windows has powershell disabled for security reasons. Out of curiosity did you change your default terminal in the steps at 0:43?

  • @edpereira7767
    @edpereira7767 10 หลายเดือนก่อน

    Awesome code ! Thank you !!!

  • @Lioneriod
    @Lioneriod 10 หลายเดือนก่อน

    Bro is just insane, thank you so much for this video man

  • @parkourninja21
    @parkourninja21 10 หลายเดือนก่อน

    Thank you, Steve. You saved me from manually renaming nearly 400 PDFs. And many more in the future. I'm a trial attorney who handles big medical files that are often unorganized. My RegEx is \d{1,2}(\/|-)\d{1,2}(\/|-)(\d{4}|\d{2}) then I rearrange, pad the pieces, and add a random 3-digit string to make the filename unique to sort and group date-related records.

    • @stephencodes
      @stephencodes 10 หลายเดือนก่อน

      This is awesome! I remember when I decided to first post these videos I was working a COOP and they had me looking at massive Excel files (12+ tabs & 4000+ rows) for links to other workbooks. When I first started it was done all by hand so I decided to make a Python script to search the Excel files. I remember thinking of other ways I could automate manual processes and I heard from a friend renaming a massive amount of PDFs by hand. That's when I thought to make a video on it. I'm glad it managed to help someone... never thought a trial attorney would be using Python! I've seen people in some of my fourth-year Computer Science classes that didn't even know how to code in it (congrats!), it is a very useful tool that can do so much. Enjoy all that time back :)

  • @isaacmagalhaes7279
    @isaacmagalhaes7279 10 หลายเดือนก่อน

    good stuff, I'm interested in the mini-series. Do you have a discord server?

    • @stephencodes
      @stephencodes 10 หลายเดือนก่อน

      Sorry, I'm getting around to replying to some of the comments that have been coming in the last few days. I don't have a discord but maybe that would be something to look into. To be honest I haven't used discord much since I graduated. However, in the meantime if you have a video suggestion I would always be down to investigate it. I did start my full-time job recently but I love to solve these types of problems in my free time so suggest away :)

  • @sopojarwo3483
    @sopojarwo3483 11 หลายเดือนก่อน

    How to remove pdf page using text content with python? is there tutorial....

  • @thegrandmarquisdj
    @thegrandmarquisdj ปีที่แล้ว

    what if the dataset isn't just numbers. something like: 4-4-5-r-t-tr-4-4-444

  • @aayushaggarwal9492
    @aayushaggarwal9492 ปีที่แล้ว

    Hey Stephen - i have like thousands of pdf’s in a folder with a difference that like we take your case some pdf’s have Order # basis which we want to rename however some pdf in same folder has Product # instead of order #. So how to rename within the same code? Do or works in Regex?

  • @pretro6136
    @pretro6136 ปีที่แล้ว

    lmao i actually needed to create a pdf editor recently and thought this was going to be changing the header to a line in the text🤣

  • @noctischen3253
    @noctischen3253 ปีที่แล้ว

    Hi Stephen, this works like a dream. But when I try to change the cr_regex line to suit my case it does not work. The text in my file is B/L番号(1) JBX1A12345. I only want the JBX1A12345 so I tried to change to cr_regex = r'(?<=B/L番号(1) )[A-Z]{4}\d+', it shows AttributeError: 'NoneType' object has no attribute 'group'.

  • @camiloalonso3709
    @camiloalonso3709 ปีที่แล้ว

    You're a G brother! Well fucking done!

  • @martinimhoff5973
    @martinimhoff5973 ปีที่แล้ว

    I followed line by line and i get File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'fitz'

    • @stephencodes
      @stephencodes ปีที่แล้ว

      Hi Martin, did you install PyMuPDF? The command is in the github under "Steps". If you're getting that error it means that library ins't installed.

  • @dazza254
    @dazza254 ปีที่แล้ว

    Hey, I found your other videos super useful. I was wondering if you’d be able to give a quick demo of renaming files given an array of two columns, one old name and one new name? Thanks!

  • @mountainboyindesert2357
    @mountainboyindesert2357 ปีที่แล้ว

    Thank for the nice video, can you suggest how can we modify code if we have multipage pdf and want to extract few pages only, also if pdf is scanned doc.

    • @stephencodes
      @stephencodes ปีที่แล้ว

      Hi, Thanks for the comment! Yes, extracting certain pages from a PDF is possible with PyMuPDF. Extracting text from a scanned PDF is doable but the last time I tried to do it not all the text was extracted properly (it depends on the scan quality of the PDF). I took a brief look online and it does look like it could be done with another library (I would have to do more research). Unfortunatly I just started my last semester of University so I'm a bit swamped at the moment with coding projects, so it might be awhile before I can take a better look.

    • @mountainboyindesert2357
      @mountainboyindesert2357 ปีที่แล้ว

      @@stephencodes thank you for reply..

  • @johnnyb79904
    @johnnyb79904 ปีที่แล้ว

    This is awesome man. Nice work. Would it be difficult to edit the code to exclude special characters? It worked perfectly other than instances where I had a "/" in the lookup text.

    • @stephencodes
      @stephencodes ปีที่แล้ว

      Hi Michael, Thanks! I think it should be possible. Just so I understand, say I have the following text (I want to extract what comes after orderID): Name: Bob Phone #: xxxxxxxx orderID: XAOP/1232232 Email: string@gmail.com You would only want to extract XAOP1232232? (not including the "/").

  • @viduzy
    @viduzy ปีที่แล้ว

    Cool!

  • @rayray7244
    @rayray7244 ปีที่แล้ว

    Bro this was great!

  • @NainAidaa
    @NainAidaa ปีที่แล้ว

    what plugin to display orders.xlsx or *.xlsx in vscode

    • @stephencodes
      @stephencodes ปีที่แล้ว

      Excel Viewer by GrapeCity: prnt.sc/boDFbB7aRXhp

    • @NainAidaa
      @NainAidaa ปีที่แล้ว

      @@stephencodes thank's

  • @snakeheadvn761
    @snakeheadvn761 ปีที่แล้ว

    Thanks so much

  • @alexsherwood4551
    @alexsherwood4551 ปีที่แล้ว

    I'm getting this error " [WinError 32] The process cannot access the file because it is being used by another process:". Any ideas?

    • @alexsherwood4551
      @alexsherwood4551 ปีที่แล้ว

      This error was due to problems with indentation. My rename() function was tabbed over one too many placing it under the "with open" block instead of the for loop block. If anyone else makes this mistake, double check that your indentation matches the indentation on line 14 at time stamp 6:46 in the video.

    • @stephencodes
      @stephencodes ปีที่แล้ว

      I believe that error happens if you're trying to rename the pdf while it is open. Operating systems have restrictions on how data can be accessed/changed. If one process is reading a file (you having the pdf open) and another is trying to modify an attribute of the file (the python script changing the filename) the operating system won't allow it. If you try opening the pdf in any viewer, like adobe acrobat and try running the script, I think you'll get that same error.

  • @KinqNick
    @KinqNick 2 ปีที่แล้ว

    nice video. Can u explain why us using a virtual enviroment and why u nit using pypdf2?

    • @stephencodes
      @stephencodes 2 ปีที่แล้ว

      Hi Kick, the reason for using a virtual environment is to keep packages separate for different projects. If we didn't use a virtual environment we would be installing packages globally across the operating system which could cause issues if different projects use different versions of the same package. Another reason is I sometimes mess up installations and it is a pain to try and fix a package that is installed globally (in this case I just re-create the virtual environment). Although I only really used one package I do it more out of habit and convenience. I believe the reason for using PyMuPDF over pypdf2 was because pypdf2 messed up the document structure when grabbing the contents of PDFs. I tried a couple other packages but PyMuPDF was the one that worked.

  • @bonfirehost
    @bonfirehost 2 ปีที่แล้ว

    pls make video on pdf 2 line 3 word

  • @rsilo718
    @rsilo718 2 ปีที่แล้ว

    Can you telll me how can i rename on the 2nd element on the file?. example instead of renaming it case 7891223 ill rename it to Larry on the description.

    • @stephencodes
      @stephencodes 2 ปีที่แล้ว

      I have a video up that does something like this with regex. If you want to pull a name without using a format structure (grabbing text that comes after a certain word for example), then you may need to use another library. Is this what you're trying to do?

  • @greenlight4056
    @greenlight4056 2 ปีที่แล้ว

    how we do it ? if want to take diif text from pdf like case num , doc number , name and save with this file name for example: using the naming format "C:\...\Case Name\DocumentNumber FilingDate LastName FilingType.pdf." "C:\...\Leal v. Bedel et al\#026 2022-07-02 Staedter Motion for Extension of Time to File Answer.pdf."

    • @stephencodes
      @stephencodes 2 ปีที่แล้ว

      Are trying to create file folders in this example? (Leal v. Bedel et al). Another question; is your Case Name, DocumentNumber, FilingData, LastName and FilingType on separate lines in the PDF?This shouldn't be too hard to implement, let me know and I can try and make a video.

    • @greenlight4056
      @greenlight4056 2 ปีที่แล้ว

      @@stephencodes now i want to scrape multiple text from pdf like(name,casenumber) and i want to save like that: c:/stephen/45236476/.pdf

    • @stephencodes
      @stephencodes 2 ปีที่แล้ว

      @@greenlight4056 Sorry for another question, I want to make sure I understand what you're saying. I'm a bit confused by your (\)s. Say I have this PDF file: Case name: Leal v. Bedel et al Document number: #026 Filing date: 2022-07-02 Last name: Staedter Filing Type: Motion for Extension of Time to File Answer I wouild first create a folder called "Leal v. Bedel et al": prnt.sc/GLgg2tlZbyvm Then I would save a pdf like so (inside the above folder): prnt.sc/5b1A2OP6YX_y

    • @greenlight4056
      @greenlight4056 2 ปีที่แล้ว

      @@stephencodes yes

    • @WAAB101
      @WAAB101 ปีที่แล้ว

      @@stephencodes Hi Stephen! could you please make a video on how to do it and especially when there is for instance invoice number and OCR number then pick OCR. also if I could save it with an underscore between them. Ex: OCRnumber_comapnyname. I really appreciate your support and time!

  • @giamonioz
    @giamonioz 2 ปีที่แล้ว

    Man Thank you so much, worked like a charm

  • @robertcenusa8636
    @robertcenusa8636 2 ปีที่แล้ว

    Finally the proper tutorial. Thank you for your work! Could you please help to rename it by the 16th line for example? Many thanks anyway!

    • @robertcenusa8636
      @robertcenusa8636 2 ปีที่แล้ว

      I've managed it (i think) with this code: new_file_name = text.splitlines()[15] rename(pdf, new_file_name + '.pdf')

    • @stephencodes
      @stephencodes 2 ปีที่แล้ว

      @@robertcenusa8636 Glad you got it working! Yeah I think that should work, just keep in mind splitlines() will split on the following characters, not just newline characters: www.programiz.com/python-programming/methods/string/splitlines (probably be rare you encounter any of the other characters though).

  • @TacosYBurritos8P
    @TacosYBurritos8P 2 ปีที่แล้ว

    Moving away from pdfs, are you familiar with API’s ? Can you use Python to code data entry automation to get data from an excel sheet and input it into another program and have it click through a certain sequence of buttons/prompts?

    • @stephencodes
      @stephencodes 2 ปีที่แล้ว

      I have experience with APIs although this might be a bit more complicated, I did read something this morning that did sound promising though. Do you have a specific application in mind?

    • @TacosYBurritos8P
      @TacosYBurritos8P 2 ปีที่แล้ว

      @@stephencodes Chrome, for a financial website. Getting a number from a cell in excel, clicking some buttons in the website then inputting the number in a field, then clicking some more buttons, then going to the next row in excel. OR how about automating going to various sites to download the most recent pdf from a list? I can go on and on, idk if you really wanna read a whole wishlist lol

    • @stephencodes
      @stephencodes 2 ปีที่แล้ว

      ​@@TacosYBurritos8P I actually made a Python script that did this for a IP hosting website (minus the excel part). The script worked for about a year before the website introuduced a captcha system at login I'll try and take a look again, I was reading and there appears to be a way to get past the captcha system maybe. It might take a bit longer to figure out though

    • @stephencodes
      @stephencodes 2 ปีที่แล้ว

      Just an update, I'm still trying to make this video... sorry it is taking so long, work and life has been busy

    • @stephencodes
      @stephencodes ปีที่แล้ว

      Video is now up with code... Sorry again for these long delays between requests. I hope the video isn't too confusing, if it is I can try to re-create the steps I took in brand-new project.

  • @stephencodes
    @stephencodes 2 ปีที่แล้ว

    Reminder: BACKUP YOUR FILES BEFORE PROCEEDING.

  • @mohamedbouamara689
    @mohamedbouamara689 2 ปีที่แล้ว

    Hi sir. Great work, many thanks. How can I change the paper size of multiple pdf files without change there names with for loop? thank you too much.

    • @stephencodes
      @stephencodes 2 ปีที่แล้ว

      Hi Mohamed, you can just call me Stephen, I think this should be doable. You're talking about the print size right? Like A1, A2, A3... paper size?

  • @shubhamchavan9287
    @shubhamchavan9287 2 ปีที่แล้ว

    Hey really loved your video and im currently trying to do the same problem.My problem is that i have excel file of names and numbers and have to rename my file using that data.If you could make a video on it it would be great.

    • @stephencodes
      @stephencodes 2 ปีที่แล้ว

      Yeah that would definitely be possible! Are you able to provide some dummy lines from the excel file and dummy PDFs/names of the PDFs you're trying to rename so I have a clearer picture? By dummy I mean generic data so you you aren't revealing your actual data

    • @shubhamchavan9287
      @shubhamchavan9287 2 ปีที่แล้ว

      @@stephencodes ok i have a data of 2000+ pdfs and i have to break them into single page pdfs and rename them differently using excel sheet data. the pdf name should be in particular order like 2022_(ID)_(name).you could take any name and numbers to show the example.just help me how with a feasible solution where i have to do it 2000 times.

    • @stephencodes
      @stephencodes 2 ปีที่แล้ว

      @@shubhamchavan9287 Okay, that makes more sense now, I'll try working on something

    • @stephencodes
      @stephencodes 2 ปีที่แล้ว

      New video is up, let me know if it addressed your problem.

  • @TacosYBurritos8P
    @TacosYBurritos8P 2 ปีที่แล้ว

    Omg the first time my comment is in a video! Thank you so much for this amazing tutorial! When are you going to set up a Patreon?! Or I can pay you back in calculus videos or any higher level math tutoring!

    • @stephencodes
      @stephencodes 2 ปีที่แล้ว

      Haha, first time for everything! I probably won't setup a Patreon unless I manage to do this a bit more seriously. Fortunately, I've already passed calculus 1 & 2 (somehow, haha). Feel free to make another request, I do enjoy making these videos!

  • @stephencodes
    @stephencodes 2 ปีที่แล้ว

    IMPORTANT: If you do NOT CARE about what comes after the keyword for the positive lookbehind expression, use the following instead: (?<=Order #: ).+

    • @stefaniamarques9979
      @stefaniamarques9979 ปีที่แล้ว

      Hi stephen, how do I make this, but the line after? I´m a litle bit confused... Thanks

    • @stephencodes
      @stephencodes ปีที่แล้ว

      @@stefaniamarques9979 Hi Stefania, if we were trying to capture the "Purchase method" line we would uise this regex (I've also included a link at the end of this comment): Order #:.*[ ](.+) Keep in mind we would have to change our code on line 21 (see github) to include .group(1) instead of just .group() (if I did this correctly, I did test it a bit). Refer to this link which explains it better: stackoverflow.com/questions/65503992/how-to-extract-the-next-line-after-a-specific-keyword-when-there-are-words-in-be

  • @TacosYBurritos8P
    @TacosYBurritos8P 2 ปีที่แล้ว

    How would you rename the pdf after scanning for specific words or format? For example renaming the pdf whatever is in the pdf after the the term “invoice#” or “due” to rename it the due date. Or having a list of names to searching within the pdf and if a particular name is found in the pdf the pdf is renamed that.

    • @stephencodes
      @stephencodes 2 ปีที่แล้ว

      New video covers this (just uploaded, sorry for delay)

  • @mrnarason
    @mrnarason 2 ปีที่แล้ว

    can you give some examples how to grab, locate or isolate the text to rename the pdf file name from different sections or under particular conditions of the pdf file? The regular expression method you mentioned in the github seems pretty useful for this.

    • @stephencodes
      @stephencodes 2 ปีที่แล้ว

      Yes, I'll try and make a video doing some examples of regular expressions. It might take a week or so since I have to bursh up on it.

    • @stephencodes
      @stephencodes 2 ปีที่แล้ว

      Sorry, I haven't forgotten about this request. I've just been really busy with school and job searching for the summer. During reading week (this week) I will try and do a video.

    • @stephencodes
      @stephencodes 2 ปีที่แล้ว

      Again, sorry for the delay but the new video + code is up.

    • @Lioneriod
      @Lioneriod 10 หลายเดือนก่อน

      @@stephencodes bro is the most responsible youtuber I've ever seem. Also, thank you a lot for making these videos!

  • @dara0013
    @dara0013 2 ปีที่แล้ว

    Thank you very much!

  • @abdallahabdelmajeed8120
    @abdallahabdelmajeed8120 2 ปีที่แล้ว

    Wonderful, thank you very much!

  • @stephencodes
    @stephencodes 2 ปีที่แล้ว

    GIthub: github.com/steve-codes/python-fileRename

  • @abdallahabdelmajeed8120
    @abdallahabdelmajeed8120 2 ปีที่แล้ว

    Thank you very much, I'd like to rename a set of PDF files based on the title inside the file, how can I do that using python? Thanxs in advance.

    • @stephencodes
      @stephencodes 2 ปีที่แล้ว

      This should be possible. I'm currently finishing up my exams but I'll take a look soon.

    • @stephencodes
      @stephencodes 2 ปีที่แล้ว

      New video on how to do this is posted. Sorry for the delay! (It might need some time for HD to complete).