How to use the pygsheets.custom_types.ValueRenderOption function in pygsheets

To help you get started, we’ve selected a few pygsheets examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nithinmurali / pygsheets / pygsheets / sheet.py View on Github external
:param spreadsheet_id:              The ID of the spreadsheet to retrieve data from.
        :param value_range:                 The A1 notation of the values to retrieve.
        :param major_dimension:             The major dimension that results should use.
                                            For example, if the spreadsheet data is: A1=1,B1=2,A2=3,B2=4, then
                                            requesting range=A1:B2,majorDimension=ROWS will return [[1,2],[3,4]],
                                            whereas requesting range=A1:B2,majorDimension=COLUMNS will return
                                            [[1,3],[2,4]].
        :param value_render_option:         How values should be represented in the output. The default
                                            render option is ValueRenderOption.FORMATTED_VALUE.
        :param date_time_render_option:     How dates, times, and durations should be represented in the output.
                                            This is ignored if valueRenderOption is FORMATTED_VALUE. The default
                                            dateTime render option is [DateTimeRenderOption.SERIAL_NUMBER].
        :return:                            `ValueRange `_
        """
        if isinstance(value_render_option, ValueRenderOption):
            value_render_option = value_render_option.value

        if isinstance(date_time_render_option, DateTimeRenderOption):
            date_time_render_option = date_time_render_option.value

        request = self.service.spreadsheets().values().get(spreadsheetId=spreadsheet_id,
                                                           range=value_range,
                                                           majorDimension=major_dimension,
                                                           valueRenderOption=value_render_option,
                                                           dateTimeRenderOption=date_time_render_option)
        return self._execute_requests(request)