tanaikech / gdoctableapppy Goto Github PK
View Code? Open in Web Editor NEWThis is a python library to manage the tables on Google Document using Google Docs API.
License: MIT License
This is a python library to manage the tables on Google Document using Google Docs API.
License: MIT License
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'
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!
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.
I want to insert another row between the 2nd and the 3rd row, for example:
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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.