gspread icon indicating copy to clipboard operation
gspread copied to clipboard

feat: add method to split text into columns

Open jiisanda opened this issue 8 months ago • 1 comments

Issue and Discussion: #1000

Update

  • Adding a DelimiterType StrEnum in utils.py.
  • Adding a text_to_column method in Worksheet class... something like this...
    @cast_to_a1_notation
    def text_to_column(
        self,
        source_range: str,
        delimiter_type: DelimiterType = DelimiterType.comma,
        custom_delimiter: Optional[str] = None,
    ) -> JSONResponse:

Usage for csv will be like...

worksheet.text_to_column("A1:A4", DelimiterType.comma)

@alifeee @lavigne958 its ready for review... let me know if you have any feedback...

jiisanda avatar Jun 11 '25 21:06 jiisanda

thanks for this change ! it looks very well crafted ;]

as for these tests which fail, I believe all tests in worksheet_test.py initialise a spreadsheet object (here), so unless this fixture is turned off for the tests, they will need API access, and therefore a VCR cassette

https://github.com/jiisanda/gspread/blob/4292e133a108d1d93c5471ab006b796e943da3f0/tests/worksheet_test.py#L2110-L2113

alifeee avatar Jun 26 '25 12:06 alifeee