# 11. Bulk uploading through Python

### Introduction to the Python script:

Click on the word [repository](https://gitlab.com/stidt/bulk-upload-python) to be taken where the script is so you can download it.

**This script has the following useful features:**

* It doesn't spam the screen with Chrome windows while it works. It does everything in the terminal window.
* Has basic error checking and retrying for the same address in the _.csv_ file until it's properly integrated to Smartlead.
* Will skip any addresses that already exist in your Smartlead account based on your API key's retrievable information.
* Counts progress per address so you can know when it's going to be done more or less.



### Steps to get the script working in half an hour:

For this tutorial we are going to assume you're a macOS user. **If you're on Windows, read until the end before doing anything.**

1. Open your terminal and insert this, then press enter:

```
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```

2. If asked, insert your computer's password. Then, insert this and press enter:

```
brew update
```

3. Now, this:

```
brew upgrade
```

4. You're now going to visit the Python website and download the corresponding installer for macOS:

<figure><img src="https://1061767816-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxOe8M6U2iJIhzcITGyrV%2Fuploads%2F5cjvCnQTEvUDlfaa8WMN%2FCleanShot%202024-01-16%20at%2001.26.58%402x.png?alt=media&#x26;token=c2e625b5-b4cd-4c9f-b069-156829f64854" alt=""><figcaption></figcaption></figure>

5. If your installation was correct, you'll be able to verify that it worked with the following terminal command:

```
python --version
```

Here's how it should look like normally:

<figure><img src="https://1061767816-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxOe8M6U2iJIhzcITGyrV%2Fuploads%2F54kT8D0Qwj9RgWjQq4be%2FCleanShot%202024-01-16%20at%2001.28.34%402x.png?alt=media&#x26;token=66f6fef2-d8f8-4bb5-ae48-1bd72edbe181" alt=""><figcaption></figcaption></figure>

6. Now that Python is installed, install all of these one by one:

```
brew install chromedriver
```

```
pip install selenium
```

```
pip install colorama
```

7. Now move the _.csv_ file you want to upload to Smartlead into the downloads folder, by first entering this command:

```
cd Downloads
```

8. Now if you type in the following command, you'll see that your file is there

```
ls
```

<figure><img src="https://1061767816-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxOe8M6U2iJIhzcITGyrV%2Fuploads%2FEAMH1smF3cEMpSu61Qb0%2FCleanShot%202024-01-16%20at%2001.33.12%402x.png?alt=media&#x26;token=975cc7a5-f9a8-4993-96e0-b3b81fd4944d" alt=""><figcaption></figcaption></figure>

9. Copy the path of your _.csv_ file by doing the following and pasting with "cd + (path)"

<figure><img src="https://1061767816-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxOe8M6U2iJIhzcITGyrV%2Fuploads%2FJnoYumSWhrqyP1M0SIty%2FCleanShot%202024-01-16%20at%2001.35.30%402x.png?alt=media&#x26;token=9b08b291-837f-4441-bc86-1f100c50fa25" alt=""><figcaption></figcaption></figure>

11. You will be asked the following things before the script starts:

* **API key:** You get this from your Smartlead account's settings.
* _**.csv**_**&#x20;path:** See above.
* **Microsoft OAuth link:** Below is shown how to get it.

<figure><img src="https://1061767816-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxOe8M6U2iJIhzcITGyrV%2Fuploads%2FOXvVStInPE9yYfpgAXDI%2FCleanShot%202024-01-16%20at%2001.39.27%402x.png?alt=media&#x26;token=2da2abfe-5895-4e2b-ba52-9076ec6c5cca" alt=""><figcaption></figcaption></figure>

Whatever link you see in the Microsoft screen that follows, you must copy into the script:

<figure><img src="https://1061767816-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxOe8M6U2iJIhzcITGyrV%2Fuploads%2F0w4AWBxn6Uig8xYyQOoB%2FCleanShot%202024-01-16%20at%2001.42.56%402x.png?alt=media&#x26;token=6cc92f30-c4de-4922-b5e6-51bfce1c41bc" alt=""><figcaption></figcaption></figure>

12. Here's how the Python window should look after you type in the following command (You must make sure the script is also in the downloads folder) and insert the information from step 11:

```
python sl-python.py
```

<figure><img src="https://1061767816-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxOe8M6U2iJIhzcITGyrV%2Fuploads%2FKJAWAGiYV765M7MvaWBV%2FCleanShot%202024-01-16%20at%2001.44.11%402x.png?alt=media&#x26;token=bb6dd66a-22ca-4039-b2a8-fa24d74b3e37" alt=""><figcaption></figcaption></figure>

13. If you did everything correctly, it's going to start uploading your accounts to Smartlead and output something similar to this:

<figure><img src="https://1061767816-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxOe8M6U2iJIhzcITGyrV%2Fuploads%2FMghLI3UU0TFrRIukEFNG%2FCleanShot%202024-01-16%20at%2001.46.22%402x.png?alt=media&#x26;token=987f2423-1231-4f11-a4aa-6836bffa0ab7" alt=""><figcaption></figcaption></figure>

### Final notes:

* It takes around one hour and thirty minutes to complete. Better than most VAs, but you should dedicate an entire day to running this script before officially sending emails, especially if you have more than five.
* If it outputs errors but it's still going, let it run and don't halt the process.
* Make sure all your accounts exist in Smartlead after it's done.

### Advice for Windows users:

* No need to install _brew_. Instead, you install Chromedriver directly from [this link](https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/120.0.6099.109/win64/chromedriver-win64.zip) and move on with installing Python and _pip_ modules.
* Here's how to copy your _.csv_ file's path:

<figure><img src="https://1061767816-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxOe8M6U2iJIhzcITGyrV%2Fuploads%2Fssu56epZvXdggcz7tHQC%2FCleanShot%202024-01-16%20at%2001.52.58%402x.png?alt=media&#x26;token=0a210711-77f3-4082-b223-d7852095adad" alt=""><figcaption></figcaption></figure>

* Besides the aforementioned, the process is the same.
