def insert_row(self, values, index=1):
        """"Adds a row to the worksheet at the specified index and populates it with values.
        Widens the worksheet if there are more values than columns.

        :param values: List of values for the new row.
        """
        if index == self.row_count + 1:
            return self.append_row(values)
        elif index > self.row_count + 1:
            raise IndexError('Row index out of range')

        self.add_rows(1)
        data_width = len(values)
        if self.col_count < data_width:
            self.resize(cols=data_width)

        # Retrieve all Cells at or below `index` using a single batch query
        top_left = self.get_addr_int(index, 1)
        bottom_right = self.get_addr_int(self.row_count, self.col_count)
        range_str = '%s:%s' % (top_left, bottom_right)

        cells_after_insert = self.range(range_str)

        for ind, cell in reversed(list(enumerate(cells_after_insert))):
            if ind < self.col_count:
                # For the first row, take the cell values from `values`
                new_val = values[ind] if ind < len(values) else ''
            else:
                # For all other rows, take the cell values from the row above
                new_val = cells_after_insert[ind - self.col_count].value
            cell.value = new_val

        self.update_cells(cells_after_insert)
dataset/ETHPy150Open burnash/gspread/gspread/models.py/Worksheet.insert_row/original