<commit_before>gssheet
=======

An alternative python library for using the Google Spreadsheets API.

as of 10/09/2012, Still working on cleaning up the api (/ everything) for more general use, so please bear with me. Things (up to and including everything) may be broken.

Accessing the google spreadsheets api using the gdata library didn't seem very abstract - you still had to worry about the xml structure, and the way to access and set cells didn't seem very intuitive. Python should be easy, so I made an attempt to make it so.

### Usage

> # First, open settings.py and set your CLIENT_ID and CLIENT_SECRET.
> # To create those values, go to the below url and create a client id of type
> # "Installed application" with default redirect uris.
> # https://code.google.com/apis/console/#:access
> 
> from gssheet import spreadsheet 
> # The first time you do this, it will pop up a browser window to get oauth
> # access to your spreadsheets.
> ss = spreadsheet.SpreadsheetAPI()
> spreadsheets = ss.get_list()
> # TODO: get the spreadsheet id you want by name, or something..
> 
> # create a worksheet with a header row
> ws = ss.create_sheet('Food diary', header=['Consumption date', 'What tastiness is this??'])
> # You can use ws as-is, or you can get other worksheets
> ws = ss.worksheets['Secret delicio.us foodzes!']
> # But no. Let's stick with what we know.
> ws = ss.worksheets['Food diary']
> # We can add a row...
> ws.cells.append(['10/09/2012', 'bacon-wrapped fried ice cream'])
> # which is equivalent to this:
> ws.cells[ws.cells.row_count + 1, ws.cells.col_count] = [
>   '10/09/2012', 'bacon-wrapped fried ice cream']
> # Or set one TODO: should be able to set to a string directly
> ws.cells[2,2] = ['bacon-wrapped deep-fried ice cream']
> # Note the arrays are 1-indexed (not 0-indexed), so [1,1] is the first cell
> # You can also rename the worksheet
> ws.modify(rename='Yummy foods')
> # And create a copy of it
> ws.copy_to("Can't get enough")
> # And when you're done...
> ws.delete()<commit_msg>What? I'm not a n00b at markdown. *shifty eyes*<commit_after>gssheet
=======

An alternative python library for using the Google Spreadsheets API.

as of 10/09/2012, Still working on cleaning up the api (/ everything) for more general use, so please bear with me. Things (up to and including everything) may be broken.

Accessing the google spreadsheets api using the gdata library didn't seem very abstract - you still had to worry about the xml structure, and the way to access and set cells didn't seem very intuitive. Python should be easy, so I made an attempt to make it so.

### Usage

    # First, open settings.py and set your CLIENT_ID and CLIENT_SECRET.
    # To create those values, go to the below url and create a client id of type
    # "Installed application" with default redirect uris.
    # https://code.google.com/apis/console/#:access
    
    from gssheet import spreadsheet 
    # The first time you do this, it will pop up a browser window to get oauth
    # access to your spreadsheets.
    ss = spreadsheet.SpreadsheetAPI()
    spreadsheets = ss.get_list()
    # TODO: get the spreadsheet id you want by name, or something..
    
    # create a worksheet with a header row
    ws = ss.create_sheet('Food diary', header=['Consumption date', 'What tastiness is this??'])
    # You can use ws as-is, or you can get other worksheets
    ws = ss.worksheets['Secret delicio.us foodzes!']
    # But no. Let's stick with what we know.
    ws = ss.worksheets['Food diary']
    # We can add a row...
    ws.cells.append(['10/09/2012', 'bacon-wrapped fried ice cream'])
    # which is equivalent to this:
    ws.cells[ws.cells.row_count + 1, ws.cells.col_count] = [
      '10/09/2012', 'bacon-wrapped fried ice cream']
    # Or set one TODO: should be able to set to a string directly
    ws.cells[2,2] = ['bacon-wrapped deep-fried ice cream']
    # Note the arrays are 1-indexed (not 0-indexed), so [1,1] is the first cell
    # You can also rename the worksheet
    ws.modify(rename='Yummy foods')
    # And create a copy of it
    ws.copy_to("Can't get enough")
    # And when you're done...
    ws.delete()
{'fraction_non_alphanumeric': 0.101878612716763, 'fraction_numerical': 0.015414258188824663, 'mean_word_length': 3.5239651416122006, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 35, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5898422', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1245, 'n_words': 561}