If you are like me, just the mention of “Python” or “script” scares you, and you just wish to say, “I have no programming knowledge.” And scroll on! But I dare you to read this as AI has made the process simple, and one simple script, generated in seconds, can save you days of work. | ||||
I am the same, and I have no coding knowledge, but I do have a bunch of boring, repetitive tasks that waste my work hours. What if you also could complete hours of monotonous work in just a few seconds? With AI, you can! You can use Copilot or ChatGPT to help you write code to automate tasks, making your workday a breeze. Let’s look into two simple scenarios of how to use AI to generate a few lines of code that can do your task in seconds. | ||||
Step-by-Step Guide to Email Cross-Referencing | ||||
Step 1: Define the task | ||||
I wanted to create a script that will look through a list of 3000 email addresses ( ‘check.csv’) I want to add to my contact list (I have them exported in .csv) and cross-reference them with my existing contact list (exported from Gmail in .csv format). Logically, there are two tasks here: 1) Export all unique emails from my contact list, and 2) compare two lists and output all new unique emails. | ||||
| ||||
Step 2: Set Up Your Environment | ||||
Copilot indicates that it created the script in Python (in my case), so before I started, I installed Python on my computer (it is free). Python is a versatile programming language, and probably you’ll also use it to run your scripts. For easier use, I also downloaded the PyCharm IDE tool for easier management of Python files. Free version of PyCharm was enough for this task. | ||||
Step 3: Export all unique emails from my contact list | ||||
Make a new folder on your computer and place a .csv file with all of your existing contact data as ‘input.csv’ and create a new empty file, ‘extracted_emails.csv’ where Python will save a list of unique emails. I created the file in Notepad as “.txt” and just renamed it to “.csv”. Create another file in Notepad called “Script 1.txt” and copy the script that Copilot created into it. Rename it to “Script 1.py” (Python file) so PyCharm can read it. Open PyCharm and go to the “Open” tab in the browser scroll to your Script 1.py file and open it. When the script is opened, click “Run,” and the task will be performed. In my case, it transferred all unique emails to the new file ‘extracted_emails.csv’. | ||||
Step 4: Compare two lists and output all new unique emails | ||||
In the second task we want to find unique emails in the checklist that aren’t in the source list and save them to a new file. In the new folder, I placed the file ‘extracted_emails.csv’ and renamed it to ‘input.csv’ (because Copilot attributed new names in the script). In the same folder, I placed the ‘check.csv’ containing a list of additional emails that need to be cross checked (if they are already in my contact list). All emails that are not already on my contact list (‘input.csv’) will be added by Python to the output file ‘output.csv’, and I can import them directly to my contacts in Gmail. | ||||
| ||||
And that is it. We have done it 😮😎🕺. Your first script in Python. | ||||
Automatically create 100 folders named based on my list | ||||
This second example you can try by yourself and it does not even require Python. | ||||
I wanted Copilot to create a simple script I can use to create 100 new folders named based on a list of 100 emails I have on my list (I will add a list ‘output.csv’ from the previous example). I need these folders to keep track of documents exchanged with our customers. | ||||
Copilot: “Below is a simple batch script that you can use in a | ||||
| ||||
“The script assumes that the names are in the first column of the CSV file. If they are in a different column, you’ll need to adjust the | ||||
This script will create a new folder for each name in your list, provided the names do not contain any characters that are invalid for folder names in Windows. If they do, you’ll need to add additional logic to sanitize the folder names. Remember to place the .bat file in the same directory as yours.csv file for it to work correctly. | ||||
Conclusion: Empower Your Productivity | ||||
With Copilot, you’re not just writing code; you’re crafting solutions to real-world problems. You have tried two small projects, but these scripts are just the beginning. Now, go and try some of your own ideas, and you will see your productivity skyrocket 🚀🚀. | ||||
| ||||
