Coder Social home page Coder Social logo

tanaikech / gdoctableapppy Goto Github PK

View Code? Open in Web Editor NEW
31.0 2.0 2.0 140 KB

This is a python library to manage the tables on Google Document using Google Docs API.

License: MIT License

Python 100.00%
python python-library library google-docs google-docs-api table manager developer-tools

gdoctableapppy's Introduction

gdoctableapppy's People

Contributors

subodh-malgonde avatar tanaikech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gdoctableapppy's Issues

Deleting only rows

Is it possible to delete only rows and not any columns? Looking at the code it appears to assume the deleteColumns key is present. Would be super easy to modify, hmu if you want a pull request.

resource = {
    "oauth2": creds,
    "documentId": copy_id,
    "tableIndex": 0,
    "deleteRows": [3],
    "deleteColumns": []
}
res = gdoctableapp.DeleteRowsAndColumns(resource)
print(res)  # You can see the retrieved responses from Docs API.

Traceback (most recent call last):
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_exec2.py", line 3, in Exec
    exec(exp, global_vars, local_vars)
  File "<string>", line 8, in <module>
  File "/opt/miniconda3/envs/templating/lib/python3.7/site-packages/gdoctableapppy/gdoctableapp.py", line 38, in DeleteRowsAndColumns
    return gdoctableapp(resource).deleteRowsAndColumns()
  File "/opt/miniconda3/envs/templating/lib/python3.7/site-packages/gdoctableapppy/gdoctableapp.py", line 728, in deleteRowsAndColumns
    self.__deleteRowsAndColumnsMain()
  File "/opt/miniconda3/envs/templating/lib/python3.7/site-packages/gdoctableapppy/gdoctableapp.py", line 356, in __deleteRowsAndColumnsMain
    maxDeleteCols = max(self.obj["params"]["deleteColumns"]) + 1
ValueError: max() arg is an empty sequence
resource = {
    "oauth2": creds,
    "documentId": copy_id,
    "tableIndex": 0,
    "deleteRows": [3]
}
res = gdoctableapp.DeleteRowsAndColumns(resource)
print(res)  # You can see the retrieved responses from Docs API.

Traceback (most recent call last):
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_exec2.py", line 3, in Exec
    exec(exp, global_vars, local_vars)
  File "<string>", line 7, in <module>
  File "/opt/miniconda3/envs/templating/lib/python3.7/site-packages/gdoctableapppy/gdoctableapp.py", line 38, in DeleteRowsAndColumns
    return gdoctableapp(resource).deleteRowsAndColumns()
  File "/opt/miniconda3/envs/templating/lib/python3.7/site-packages/gdoctableapppy/gdoctableapp.py", line 728, in deleteRowsAndColumns
    self.__deleteRowsAndColumnsMain()
  File "/opt/miniconda3/envs/templating/lib/python3.7/site-packages/gdoctableapppy/gdoctableapp.py", line 356, in __deleteRowsAndColumnsMain
    maxDeleteCols = max(self.obj["params"]["deleteColumns"]) + 1
KeyError: 'deleteColumns'

Ruby?

Hello, I really think this library can facilitate my work and the work of my coworkers in Ruby-land. Are you aware of anything similar for Ruby? thanks!

How to insert a row between 2 rows?

Hello Tanaike! This is a fantastic library. Thanks for it.

I am trying to figure out how to do this - I have a table with 3 rows.
Screenshot 2020-01-17 at 4 30 37 PM

I want to insert another row between the 2nd and the 3rd row, for example:
Screenshot 2020-01-17 at 4 30 25 PM

How do I do this using gdoctableapppy?

I can think of modifying the appendrow function to accept an additional argument row_index. row_index will tell us after which row we wish to append the row. For example, if row_index = 0, this means that append a row after the 1st row. If row_index is not specified then append the rows after the last row.

ReplaceTextsToImages not working with strings inside tables in tables

If you have a table T1, and in one of T1's cell, you have another table T2, and if you want to call ReplaceTextsToImages on a string in T2, the replacement won't work.

Though I could figure out a quick fix for this. Here it is in case it can be useful for somebody else:

gdoctableapp.py:L94
def __getTableContent(self, e):
  ar = []
    for f in e["table"].get("tableRows"):
      for g in f.get("tableCells"):
        for h in g.get("content"):
+         if "table" in h.keys():
+           ar.extend(self.__getTableContent(h))
+         else:
            self.__getTextRunContent(ar, h)
return ar

Thank you for your work!

Sourigna

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.