Google Docs/Apps APIs: Spreadsheets (Google Sheets) with Charts
Is there a way to automate the process of creating a chart within a google doc from a .NET application.
The workflow I'm looking for is...
- Create Excel Document.
- Upload to Google Docs.
- Create charts on the spreadsheet. (Can't figure this out.)
- Publish using ACLs. (bonus)
I'm not sure if I'm supposed to use the Google Chart API for this or pure Spreadsheet API.
开发者_JS百科I'm using the GData .NET client library.
http://code.google.com/p/google-gdata/
(Jun 2016) The original accepted answer is now out-of-date. As of Google I/O 2016, you can create charts within a Sheet from the Google Sheets API. First things first: 1) GData APIs are the previous generation of Google APIs... while not all have been deprecated, all newer Google APIs do not use the Google Data Protocol; and 2) there is a new Google Sheets API v4 (not GData]).
Moving forward from here, you need to get the Google APIs Client Library for .NET and use the latest Sheets API, which is much more powerful and flexible than any previous API. Here's a C# code sample to help get you started. If you're not allergic to Python, I made a video introducing the new API and gave a deeper dive into its code via a blogpost that you can learn from and effectively migrate to C# if desired. If you're not allergic to JavaScript and want to try a more complex hands-on example, the project in our Google Sheets codelab creates a chart and a pivot table using the API. You can then extrapolate how to do this in C#.
With regards to publishing and sharing/ACLs, both are done w/the Google Drive API because these are more general operations you can apply to Sheets, Docs, and Slides.
UPDATE: Confirmed by a Google employee on the Google forum this is not possible...
精彩评论