Reputation: 163
I have an Open-Source Live Data, but it's in the format of Google Spreadsheet and not CSV or JSON. How do I get this Live Spreadsheet's data in my Pandas Data Frame?
HERE is the link to that Open Source Live Spreadsheet.
Thank You
Upvotes: 0
Views: 321
Reputation: 201378
https://docs.google.com/spreadsheets/d/e/###/pubhtml#
.In this answer, I would like to propose the following flow.
Modify the endpoint. By this modification, the values can be retrieved as the CSV data.
https://docs.google.com/spreadsheets/d/e/###/pubhtml#
https://docs.google.com/spreadsheets/d/e/###/pub?output=csv
Retrieve the values from the modified endpoint as the CSV data.
Put the CSV data to the dataframe.
import io
import pandas as pd
import requests
url = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vSc_2y5N0I67wDU38DjDh35IZSIS30rQf7_NYZhtYYGU1jJYT6_kDx4YpF-qw0LSlGsBYP8pqM_a1Pd/pub?output=csv'
res = requests.get(url)
df = pd.read_csv(io.BytesIO(res.content), sep=',')
Upvotes: 1