# Looker Users Export Script

This script fetches users from Looker using the Looker API and writes the filtered users' details to a CSV file. The users are filtered to exclude disabled users and verified Looker employees. Field included are:

- `first_name`
- `second_name`
- `email_address`

Download the contents of this folder to your local machine, ideally in a new folder somewhere convinient like `Documents`.

## How to Run the Script

### Step 1: Open Terminal
- On a Mac, you can open Terminal by going to Applications -> Utilities -> Terminal.
- On Windows, you can open the Command Prompt or PowerShell.

### Step 2: Navigate to the Script's Directory
Use the `cd` command followed by the path to the directory containing your script.

```sh
cd path/to/your/script
```
For example, if your script is in the Documents folder under a folder named `looker_script`, you would type:

```sh
cd ~/Documents/looker_script
```

### Step 3:  Run the Script
The directory contains a batch file which creates a Python Virtual Environment called `venv`, installs the requisite dependencies, and executes the script. You can run the batch file with the following command:

```sh
sh requirements.sh
```

### Step 4: Enter Looker API Credentials
The script will prompt you to enter your Looker API `client_id` and `client_secret`. If you do not have these credentials, please refer to the section below on how to obtain Looker API Credentials.

### Step 5: Enter the Path to Save CSV File
The script will then prompt you to enter the path where you want to save the CSV file. You can type the path to any directory where you want to save the file, for example:

```sh
/Users/your_username/Documents
```
If the directory does not exist, the script will create it for you.

## How to Obtain Looker API Credentials
1. Log in to Looker and go to the `Admin` panel.
2. Navigate to `Users` and find your user account.
3. Click on your user account and navigate to the `API3 Keys` section.
4. Click on `+ New API3 Key` to create a new key.
5. Note down the `client_id` and `client_secret` generated. You will need to enter these when prompted by the script.

## Locating a Directory to Save the CSV File
- The directory is just a folder on your computer.
- You can navigate to the folder where you want to save the CSV file and copy the path from the address bar.
- For example, if you want to save the file in the Documents folder, the path would typically be `/Users/your_username/Documents` on a Mac.

## Caution
- Keep your API credentials secure and do not share them with anyone.
- Do not upload your script containing API credentials to public repositories or share it insecurely.
