Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to programmatically manipulate native google doc files

Is it possible to programmatically edit a native Google document, say to make certain words bold or hyperlinks? I know I can export that to some format like DOC or ODT, do the changes and put back. But tried this way manually and saw that I lost the exact look. Could not find any API or object model for native Google docs, although seems there is something for the spreadsheets.

like image 286
Sanjay Avatar asked Jul 20 '12 11:07

Sanjay


People also ask

Does Google Docs have an API?

The Google Docs API lets you create and modify documents. Apps can integrate with the Docs API to create polished documents from both user and system-provided data. The API allows you to: Automate processes.

Can you get an embed code for a Google Doc?

You can make a document, spreadsheet, presentation, or form available to view on an existing website by embedding it in your site or blog. Open a file in Google Docs, Sheets, or Slides. Publish to web. In the window that appears, click Embed.


1 Answers

Unfortunately it is not possible to programmatically edit Google Documents (Google's Word Processor document) using a REST API. Only Google Spreadsheet offers such an API at the moment.

You could try Google Apps Script: https://developers.google.com/apps-script/ it is a hosted scripting environment and it offers a Google Documents Service that allows you to edit and manage existing Google Documents.

Lastly you could always upload a document using an open format such as RTF and have it converted to a native Google Documents using the Google Drive API.

like image 56
Nicolas Garnier Avatar answered Oct 16 '22 13:10

Nicolas Garnier