-
Notifications
You must be signed in to change notification settings - Fork 948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get_all_records => provided headers #1527
Comments
hi !! thanks for your request :) the docs mention
import gspread
SPREADSHEET_ID = "uhfa3897fu3a987f389a8jf38af"
gc = gspread.service_account(filename="./creds.json")
spreadsheet = gc.open_by_key(SPREADSHEET_ID)
worksheet = spreadsheet.sheet1
headers = ["fruit", "alternate name", "tastiness"]
values = worksheet.get()
records = gspread.utils.to_records(headers, values)
for r in records:
print(r)
# {'fruit': 'apple', 'alternate name': 'red circle', 'tastiness': 'very'}
# {'fruit': 'banana', 'alternate name': 'yellow stick', 'tastiness': 'quite'}
# {'fruit': 'papaya', 'alternate name': 'seedy', 'tastiness': 'seedy'} I believe this is what you desire. However, it is clear the documentation was not clear in explaining this possibility. Perhaps it could do with an example. Would you be willing to write an example to improve the documentation ? Thanks !! :] |
Thanks @alifeee for the info! Could get_all_records be updated so that users can specify custom headers, so that developers can just use |
generally we are trying to stop feature creep for There is potential that this feature is "simple enough" to be a good cause for addition, but I think the "workaround" (using so... no ;] |
Hi as alifee said, we stopped adding features to Closing this issue. |
@lavigne958 thank you. But the creation of an issue is an example that our documentation has room for improvement, so we should improve it, thus I open the issue for this purpose |
Agreed, sorry for the prompt action. You're right 👍 |
get_all_records does not allow one to specify the headers if there is no header row. One can only skip rows via
head
or set the expected headers viaexpected_headers
, but one cannot specify the header (column) names. This feature would be quite helpful when there is no header in the table.The text was updated successfully, but these errors were encountered: