gspread icon indicating copy to clipboard operation
gspread copied to clipboard

add method to split text into columns

Open lavigne958 opened this issue 4 years ago • 2 comments

Overview

Add method to split text from a single column into multiple columns.

Details

The api provide a way to split text from a single column into multiple columns: sheet API v4

This will be very useful when importing text into a worksheet and then splitting it into columns (like from a csv data source)

expose necessary methods to split text into columns.

lavigne958 avatar Feb 20 '22 22:02 lavigne958

Hi @lavigne958.. I would like to work on implementing this feature. Here's my approach:

  • 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:

Maybe for csv the usage will be like...

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

I have a working implementation ready. Would you like me to proceed with the pull request?

jiisanda avatar Jun 07 '25 18:06 jiisanda

@jiisanda thanks for the thorough explanation !

we don't have much active coding right now from maintainers, but if you would like to implement this feature, go ahead and I will try to review it !

see the contributing guide: https://github.com/burnash/gspread/blob/master/.github/CONTRIBUTING.md

it would be good if there were a test created :]

alifeee avatar Jun 09 '25 11:06 alifeee