Automate Boring Office Tasks with ChatGPT and Python

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys in my last video I demonstrated how you can use chatgpt and python to automate Excel this time our take it a step further and show you how chatgpt can help you to automate Outlook make PowerPoint presentations from scratch create interactive charts merge PDFs compose a well written email and even create an entire website the results are truly impressive and I strongly believe after watching this video you will be able to automate some of the tedious office tasks you may have so with ultra vadu let's dive in let us start with the first example in my attachments folder I have a bunch of Excel files I want to send these Excel files to different receivers using Outlook to do this I have prepared an overview in the financial data.xlsx workbook in my previous video we also used this workbook to create the attachments this is because all the data for the different countries can be found in this worksheet if you are interested in how to split a table like this into separate workbooks you might want to check out that video but for our use case let us switch back to the email list I want jet GPT to create a python script that reads data from the sheet email list in an actual workbook called financial data.xlsx and the code should use the data in columns a b c and d to compose an open Outlook emails with different attachments and recipients also it should locate the attachments in a folder called attachments located in the same directory as the Excel workbook and construct the file path to the attachments the script reduced the recipient's name from column B in the email text and the recipient and CC email addresses from column C and D respectively lastly python should open Outlook emails but should not send them until further actions are taken and overall the python code should be robust this was a prompt I used in chat GPT for some reason I got a warning that this prompt violated the content policy I am not sure why that is but nonetheless jet GPT generated the following code for me at the bottom it also highlighted that I need to have Outlook installed on my computer I then took the code and pasted it into an empty python file when I ran this code Outlook created an email for each country as we can see it got everything right the email addresses including the CC's attachments and text are all correct it even inserted some text saying that the financial data can be found attached this is pretty impressive in my opinion the only thing I notice is that python also will turn the depreciation warning so the code once now but might lead to an error in the future so I copied the warning and pasted it into the chat to my surprise chatgpt acknowledged that this should be fixed and provided me with a modified version all I had to do was copy and paste the adjusted version and run the code again this time the image got still created but without any warnings great so for now the emails are only created and not directly sent out this is exactly what I wanted but perhaps in the future I want to send out the emails directly so I asked chatgpt how I could send out the emails and it explained to me which line of code I would need to change and suggested further error handling okay and with that let us move on to the second example and this time I want shpg to create an entire PowerPoint presentation from scratch as before I have the same Excel files let me actually open up one so that you can see the content each line represents a sales record for the respective country and I would like to group the sales by product from the aggregated data I would like to create a bar chart and insert that chart into PowerPoint let us see how we can do that with chatgpt this time I wrote down the steps in bullet points the python script should access the input folder and read all files within it for each file the data is located from columns a to P any missing values should be excluded then python should group the sales by product afterwards I want to create a chart using the C1 Library I was specific about which Library I wanted to use hi also tried it without mentioning the python package in that case chatgpt picked the matplotlib library so it's good to be specific about the library you want to use especially when you have a particular requirement but in any case those charts should be saved in a folder named charts and it should create the folder if it doesn't exist already afterwards python should create a PowerPoint presentation and insert a slide for each shot it should also include the title and once everything gets done the presentation should be saved as Financial data.pptx Additionally the code should include error handling alright so this was a very long prompt and I was really curious if chechi PT understood what I wanted to achieve so here is what chatgpt responded to my prompt as before I took the code pasted it into an empty python file and executed it also at this time I received a future warning but the code went successfully so when I go back to my directory we can see that we now have a new charts folder within this folder we now have an image for each Excel file where we can see a bar chart of the aggregated sales by product so this is already working and the PowerPoint can be found in the input folder now this presentation doesn't look visually appealing and the charts overlaps with the title but I think this is a good starting point for any further customization we now have a slide for each country for the product sales without writing a single line of code the only thing I want to change now is that the PowerPoint presentation should be saved in the same directory as the python script so I switched over to the chat and asked for an updated version as before I then took the updated code and executed it and this time we have the presentation right next to the python script okay and with that let us move on to the next example maybe instead of a static image you might want to create an interactive chart from your Excel data so we will use the same data as before and this time I simply want to sum up the sales for each country and plot it in an interactive chart now in many companies you might use corporate colors for your charts so I also included the color code in my prompt and just like that chatgpt generated the following python code and suggested further ever handling so I then asked for the full script that also included the error handling part and then I received the following code so I took the code and went it in my text editor once that was done I had a new HTML file in my folder if you open this file you will now have an interactive chart that shows the sales for each country OK and with that let us move on to the next example and this example was actually sent to me by a subscriber of mine his task was as follows he has two folders cover and draft in the cover folder we have a couple of PDFs and the file name is just a number and this is what the PDF looks like so basically this is a cover for the following PDF file and you can find this PDF file in the drafts folder now he needs to combine those two files into one so that we first have the cover and then the correct PDF from the draft folder and this is what I asked chbt to do the important part is here I provide the jgbt with an example of how those files should be matched and that was already enough to understand the pattern of the files and jgpt came up with the following solution all I had to do was copy and paste the code into my text editor and execute it however I received the following error message so I took the error message and pasted it into the chat in return I received an adjusted version of the code and at this time the code ran without any errors if I checked my directory we will now have a new output folder with the merge PDF files so to validate the result let me open up the first PDF file as we can see we now have the merge cover with the draft this can be a massive Time Saver because imagine you will need to do it manually for hundreds or even thousands of files so now that you have automated many tedious office tasks you can also ask chatgpt to write an email to your manager requesting a salary increase without much effort chatgpt has created a well-written email providing your manager with the reasons on how the automated Solutions are helping the company and why you should receive the salary increase I think these examples are pretty mind-blowing and I hope this video has inspired you to automate some of the tedious tasks you may have I've actually hosted all of the prompts I use throughout the video online you can find them at the following web address by clicking on the link you will find the perspective chat history and perhaps you've guessed it already but even this entire website was created by chatgpt you can also find the source code under the following link all right guys and that is all I have for you today let me know in the comments below what you think about chatgpt I would be curious to know if you have been able to automate any task and as always thanks for watching and see you in the next video foreign [Music]
Info
Channel: Coding Is Fun
Views: 298,548
Rating: undefined out of 5
Keywords: chatgpt, chat gpt, python and chatgpt, office automation chatgpt, ai automation, ai and python, python automation, automate the boring tasks, chatgpt tutorial, chat gpt tutorial, open ai python, open ai automation, automation examples, how to use chatgpt, how to use chat gpt
Id: mCk4Rabkmjc
Channel Id: undefined
Length: 10min 6sec (606 seconds)
Published: Sun Jan 15 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.