Skip to content

Google Sheets/Excel to Google maps - make your tasks managable in one map

License

Notifications You must be signed in to change notification settings

rangit3/TasksToMap

Repository files navigation

Tasks to Google Maps

Make your tasks managable in one map

Features

  • Input: a csv file that have addresses in a column named Address
  • Output: a csv that have 3 more columns:
-- addresses_found: which address was generated by the api
-- lat - the latitude of the address
-- long - the longitude of the address

Advanced Features

  • Get the excel directly from google sheets.
  • Tasks can be added to the google sheet automatically via Google Forms or other application.
  • Use Google Colab for full pipeline without any installations
  • Use Google Maps API to update the map

Installation

Python 3.6+
pip install -q -r requirements.txt

Usage guides

  1. Fill google sheets/ csv file with taksk image

###Must have column named "Address"

  1. Rename the csv "reports.csv"

  2. Run the script. output is "reports_updated.csv"

  3. Create a new google maps image

  4. Click on import (ייבוא)

  5. Select the location columns image

  6. The output is image

Google Colab Usage guides

Create a notebook and add the following commands (or download the notebook in the repo).

Fill the parameter URL, and index if the column name of the address is not "Address".

####Params#####
#google sheet with the tasks:
URL = ''

####Optional Params#####
# the index (starts at 0) where the address column is
# -1 means to look for column which the first cell is 'Address'
ADDRESS_INDEX = -1

# the index (starts at 0) of the worksheet to download
WORKSHEET_INDEX = 0

# Fixing the csv: There are additional parameters to fix the csv.
# Fill Cells: An option to fill the csv with default values per column. For example: !python main.py --index {ADDRESS_INDEX} --fill_pairs Status=חדש,Name=אנונימי
# Ignore Lines: An option to ignore lines with specific values inside a cell. For example: !python main.py --index {ADDRESS_INDEX} --ignore_pairs Status=נמסר

####Import The Code#####
%cd /content
#!pip install --upgrade -q gspread
%rm -r TasksToMap &> /dev/null
!git clone https://github.com/rangit3/TasksToMap.git

####Run The Code#####
from google.colab import auth
import csv
auth.authenticate_user()

import gspread
from google.auth import default
creds, _ = default()

gc = gspread.authorize(creds)
sheet = gc.open_by_url(URL)
worksheet = sheet.get_worksheet(WORKSHEET_INDEX)
data = worksheet.get_all_values()

with open('/content/TasksToMap/reports.csv', 'w', newline='') as csvfile:
    writer = csv.writer(csvfile)
    writer.writerows(data)

#upload the input csv into the created folder, and name it as reports.csv
%cd /content/TasksToMap
!pip install -q -r requirements.txt
print("\nCode is running\n")
!python main.py --index {ADDRESS_INDEX}

####Save the Results to Google Drive#####
from google.colab import drive
drive.mount("/content/drive", force_remount=True)
!cp reports_updated.csv /content/drive/MyDrive

print("\nDone. Search for reports_updated.csv in your drive!")

Licence

The Unlicense

A license with no conditions whatsoever, except terrorists.

About

Google Sheets/Excel to Google maps - make your tasks managable in one map

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published