<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Append value on Google doc  through API</title><link>https://community.appian.com/discussions/f/integrations/38295/append-value-on-google-doc-through-api</link><description>I want to ask few questions related to google doc :- 
 
 I want to append value on multiples line on google doc. 
 there is a table of 3*3 and I want to add data on each cell of table in google doc.</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Append value on Google doc  through API</title><link>https://community.appian.com/thread/144282?ContentTypeID=1</link><pubDate>Mon, 13 Jan 2025 08:38:39 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:294f46d3-76ab-4429-b080-61b86eca8bcf</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;I asked your question to ChatGPT. It came up with some Python code which you could adapt to Appian. I did not test or verify this code.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="python"&gt;from google.oauth2 import service_account
from googleapiclient.discovery import build

# Replace with your own values
DOCUMENT_ID = &amp;#39;YOUR_DOCUMENT_ID&amp;#39;
TABLE_INDEX = 0  # Index of the table in the document (0 for the first table)

# Authenticate using service account credentials
SCOPES = [&amp;#39;https://www.googleapis.com/auth/documents&amp;#39;]
SERVICE_ACCOUNT_FILE = &amp;#39;path/to/your/service-account-file.json&amp;#39;

credentials = service_account.Credentials.from_service_account_file(
    SERVICE_ACCOUNT_FILE, scopes=SCOPES)

service = build(&amp;#39;docs&amp;#39;, &amp;#39;v1&amp;#39;, credentials=credentials)

# Data to append to each cell
data = [
    [&amp;#39;Value 1&amp;#39;, &amp;#39;Value 2&amp;#39;, &amp;#39;Value 3&amp;#39;],
    [&amp;#39;Value 4&amp;#39;, &amp;#39;Value 5&amp;#39;, &amp;#39;Value 6&amp;#39;],
    [&amp;#39;Value 7&amp;#39;, &amp;#39;Value 8&amp;#39;, &amp;#39;Value 9&amp;#39;]
]

# Prepare requests to update the table
requests = []
for i in range(len(data)):
    for j in range(len(data[i])):
        requests.append({
            &amp;#39;insertText&amp;#39;: {
                &amp;#39;location&amp;#39;: {
                    &amp;#39;index&amp;#39;: get_cell_index(TABLE_INDEX, i, j),
                },
                &amp;#39;text&amp;#39;: data[i][j]
            }
        })

# Execute the batch update
result = service.documents().batchUpdate(documentId=DOCUMENT_ID, body={&amp;#39;requests&amp;#39;: requests}).execute()
print(&amp;#39;Table updated successfully!&amp;#39;)

def get_cell_index(table_index, row, column):
    # This function calculates the index of the cell in the document
    # You may need to adjust this based on your document structure
    # This is a simplified example and may not work for all documents
    # You can use the Google Docs API to get the document structure and find the correct index
    return 1  # Replace with the actual index of the cell
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Append value on Google doc  through API</title><link>https://community.appian.com/thread/144280?ContentTypeID=1</link><pubDate>Mon, 13 Jan 2025 08:13:14 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:32d8e049-3ce5-43c9-9a94-9344e2e6ffb7</guid><dc:creator>Rishu Kumar Gupta</dc:creator><description>&lt;ul&gt;
&lt;li&gt;I&amp;#39;m able to create the table but not able to append values on every cell of the table.&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Append value on Google doc  through API</title><link>https://community.appian.com/thread/144273?ContentTypeID=1</link><pubDate>Sat, 11 Jan 2025 15:23:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dc50b906-ee22-4ade-8375-5a628e1f7980</guid><dc:creator>Mathieu Drouin</dc:creator><description>&lt;p&gt;Did you check this out?&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developers.google.com/docs/api/reference/rest/v1/documents/request#InsertTextRequest"&gt;https://developers.google.com/docs/api/reference/rest/v1/documents/request#InsertTextRequest&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.google.com/docs/api/reference/rest/v1/documents/request#InsertTableRequest"&gt;https://developers.google.com/docs/api/reference/rest/v1/documents/request#InsertTableRequest&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Append value on Google doc  through API</title><link>https://community.appian.com/thread/144249?ContentTypeID=1</link><pubDate>Fri, 10 Jan 2025 10:04:42 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:89afe970-d444-4f57-b7ed-234095a6ca4d</guid><dc:creator>Rishu Kumar Gupta</dc:creator><description>&lt;p&gt;&lt;a href="/members/harshitb6843"&gt;Harshit Bumb (Appyzie)&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>