Google Sheets Reader
Insert the link to your Google Sheet
URL
import pandas as pd
import re
# This function will convert the url to a download link
def convert_gsheets_url(u):
try:
worksheet_id = u.split('#gid=')[1]
except:
# Couldn't get worksheet id. Ignore it
worksheet_id = None
u = re.findall('https://docs.google.com/spreadsheets/d/.*?/',u)[0]
u += 'export'
u += '?format=csv'
if worksheet_id:
u += '&gid={}'.format(worksheet_id)
return u
sample_url = 'https://docs.google.com/spreadsheets/d/1ih4V4CumuIl5ZynobsazNzGiaPrE2V2Dpt13FI22XNU/edit'
try:
url = convert_gsheets_url(URL)
df = pd.read_csv(url)
print('Read successfully')
except:
print(f"Could not read any data from the URL you provided.\nReading from {sample_url} instead.")
url = convert_gsheets_url(sample_url)
df = pd.read_csv(url)
Read successfully
Here is a sample of the data we were able to find:
Comune di Abano Terme10%
Comune di Abbadia Cerreto10%
8 others80%
141 - 899
0
Comune di Abano Terme
404
1
Comune di Abbadia Cerreto
817
2
Comune di Acquafredda
514
3
Comune di Adrara San Martino
261
4
Comune di Adrara San Rocco
141
5
Comune di Agnadello
340
6
Comune di Agnosine
813
7
Comune di Agrigento
719
8
Comune di Alatri
899
9
Comune di Albairate
758
10 rows, showing
per page
Page of 1