Skip to content

Commit b47aa5c

Browse files
author
Thierry Lacour
committed
Add some example usage
1 parent f3b0155 commit b47aa5c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

routes/sheets.py

+20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Google sheets related functions and classes"""
22

33
import logging
4+
import os
45

56
import pandas as pd
67
from google.oauth2 import service_account
@@ -62,3 +63,22 @@ def get_range(self, range: str) -> pd.DataFrame:
6263
logging.error(err)
6364
return []
6465
return pd.DataFrame(values)
66+
67+
68+
def main():
69+
sheet = GoogleSheets(
70+
credentials_path=os.environ.get("METRICS_GSHEET_CREDS"),
71+
spreadsheet_id=os.environ.get("METRICS_GSHEET_SHEET_ID"),
72+
)
73+
74+
range = sheet.get_range("Costs!A1:B5")
75+
print(range)
76+
77+
all_dataframes = sheet.get_all()
78+
for dataframe in all_dataframes:
79+
print("----")
80+
print(dataframe)
81+
82+
83+
if __name__ == "__main__":
84+
main()

0 commit comments

Comments
 (0)