Skip to content

Provide optional query parameters for read_gsheet #74

@zhongzachary

Description

@zhongzachary

Google's Sheets API provides a couple query parameters that are useful for this extension

  • valueRenderOption
    • Default to be FORMATTED_VALUE. With this, the get request will return values as string as they are formatted in the gsheets. This is also the current behavior of read_gsheet.
    • With UNFORMATTED_VALUE, the request will return the values as how they are stored in google sheets.
    • For example, a floating point value 2.5555, formatted as "$2.56" in the gsheets, will be returned as "$2.56" with FORMATTED_VALUE, but as 2.5555 with UNFORMATTED_VALUE. A date 1899-12-30, formatted as "12/30/1899", will be returned as 0 with UNFORMATTED_VALUE (unless user also provided the following query parameter).
  • dateTimeRenderOption
    • When valueRenderOption=UNFORMATTED_VALUE, the get request returns the serial number of a datetime like above (relative to 1899-12-30).
    • But when set this parameter to FORMATTED_STRING, the request will return the string representation of the datetime instead.

It would be great if read_gsheet can expose these optional query parameters to the user. At minimal, having the ability to specify these arguments can make the data easier to use (and more precision for the floating points). And this can also be very helpful for future effort for inferring data types.

Source: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions