ShinLun
ShinLun

Reputation: 1

Returning a random value from some column from Google Sheets only returns the first character

def search_promo_name2(
    self,
    data: List[List[Union[str, bool]]],
    search_col: int = 1,
    promo_col: int = 2
) -> int:
    googlesheet_client: pygsheets.client.Client = self._get_googlesheet_client()
    wks: pygsheets.Spreadsheet = self._get_googlesheet2_by_url(googlesheet_client)
    values = wks.get_col(promo_col, include_empty=False)
    if not values:
        return -1
    promo = random.choice(values)

    return promo

in column

BLLR48IQR9
CLL45G3WMP
WLL31HGJ64
TLLJ6A4FCJ
ELLFYF5B14

but it's returning only one ,first letter like B or E,C and etc

I am just new in Python(3 month) and in pygsheets too,i have no idea how to return a full string from cell ,like BLLR48IQR9

get_col(col, returnas='matrix', include_tailing_empty=True, **kwargs)[source]
Returns a list of all values in column col.

but it's returning only one ,first letter like B or E,C and etc

Upvotes: 0

Views: 44

Answers (0)

Related Questions