eumap.misc.GoogleSheet¶
- class GoogleSheet(key_file, url, col_list_suffix='_list', col_list_delim=',', col_date_suffix='_date', col_date_format='%Y-%m-%d', verbose=False)[source]¶
Bases:
object
Utility class able to convert a remote Google Spreadsheet file into a pandas.DataFrame. Each sheet is converted to a separate pandas.DataFrame accessible by class attribute.
- Parameters
key_file (
str
) – Authentication key to access spreadsheets via Google Sheets APIurl (
str
) – Complete URL referring to a Google Spreadsheet file (public accessible).col_list_suffix (
str
) – All the columns with this suffix are converted to a list of strings.col_list_delim (
str
) – Text delimiter used to separate the list elements.col_date_suffix (
str
) – All the columns with this suffix are converted to a date object.col_date_format (
str
) – Date format used to convert string values in date object.verbose (
bool
) – UseTrue
to print the progress of all steps.
Examples
>>> # Generate your key follow the instructions in https://docs.gspread.org/en/latest/oauth2.html >>> key_file = '<GDRIVE_KEY>' >>> # Public accessible Google Spreadsheet (Anyone on the internet with this link can view) >>> url = 'https://docs.google.com/spreadsheets/d/1O3n5O6MQ3OPX--ZbJEREC5fu-bLKK2AaTYDqeAPMRQY/edit?usp=sharing' >>> >>> gsheet = GoogleSheet(key_file, url) >>> print('Sheet points_nl: ', gsheet.points_nl.shape) >>> print('Sheet tiles: ', gsheet.tiles.shape)
Methods