GDataDocumentsSpreadsheet

## GDataDocumentsSpreadsheet GDataDocumentsSpreadsheet — GData Documents spreadsheet object |

## Stability Level

Unstable, unless otherwise indicated

## Synopsis

    #include <gdata/services/documents/gdata-documents-spreadsheet.h>

                        GDataDocumentsSpreadsheet;
                        GDataDocumentsSpreadsheetClass;
    enum                GDataDocumentsSpreadsheetFormat;
    GDataDocumentsSpreadsheet * gdata_documents_spreadsheet_new
                                                            (const gchar *id);
    GFile *             gdata_documents_spreadsheet_download_document
                                                            (GDataDocumentsSpreadsheet *self,
                                                             GDataDocumentsService *service,
                                                             gchar **content_type,
                                                             GDataDocumentsSpreadsheetFormat export_format,
                                                             gint gid,
                                                             GFile *destination_file,
                                                             gboolean replace_file_if_exists,
                                                             GCancellable *cancellable,
                                                             GError **error);
    gchar *             gdata_documents_spreadsheet_get_download_uri
                                                            (GDataDocumentsSpreadsheet *self,
                                                             GDataDocumentsSpreadsheetFormat export_format,
                                                             gint gid);

## Object Hierarchy

      GObject
       +----GDataParsable
             +----GDataEntry
                   +----GDataDocumentsEntry
                         +----GDataDocumentsSpreadsheet

## Implemented Interfaces

GDataDocumentsSpreadsheet implements GDataAccessHandler.

## Description

GDataDocumentsSpreadsheet is a subclass of GDataDocumentsEntry to represent a spreadsheet from Google Documents.

For more details of Google Documents' GData API, see the online documentation.

## Details

### GDataDocumentsSpreadsheet

    typedef struct _GDataDocumentsSpreadsheet GDataDocumentsSpreadsheet;

All the fields in the GDataDocumentsSpreadsheet structure are private and should never be accessed directly.

Since 0.4.0

### GDataDocumentsSpreadsheetClass

    typedef struct {
    } GDataDocumentsSpreadsheetClass;

All the fields in the GDataDocumentsSpreadsheetClass structure are private and should never be accessed directly.

Since 0.4.0

### enum GDataDocumentsSpreadsheetFormat

    typedef enum {
            GDATA_DOCUMENTS_SPREADSHEET_XLS = 0,
    	GDATA_DOCUMENTS_SPREADSHEET_CSV,
    	GDATA_DOCUMENTS_SPREADSHEET_PDF,
    	GDATA_DOCUMENTS_SPREADSHEET_ODS,
    	GDATA_DOCUMENTS_SPREADSHEET_TSV,
    	GDATA_DOCUMENTS_SPREADSHEET_HTML
    } GDataDocumentsSpreadsheetFormat;

The different available download formats for spreadsheets.

`GDATA_DOCUMENTS_SPREADSHEET_XLS` | Microsoft Excel spreadsheet (XLS) format
`GDATA_DOCUMENTS_SPREADSHEET_CSV` | Comma-Separated Values (CSV) format
`GDATA_DOCUMENTS_SPREADSHEET_PDF` | Portable Document Format (PDF)
`GDATA_DOCUMENTS_SPREADSHEET_ODS` | OpenDocument Spreadsheet (ODS) format
`GDATA_DOCUMENTS_SPREADSHEET_TSV` | Tab-Separated Values (TSV) format
`GDATA_DOCUMENTS_SPREADSHEET_HTML` | HyperText Markup Language (HTML) format

Since 0.4.0

### gdata_documents_spreadsheet_new ()

    GDataDocumentsSpreadsheet * gdata_documents_spreadsheet_new
                                                            (const gchar *id);

Creates a new GDataDocumentsSpreadsheet with the given entry ID ("id").

`id` : | the entry's ID (not the document ID of the spreadsheet), or `NULL`. [allow-none]
Returns : | a new GDataDocumentsSpreadsheet, or `NULL`; unref with `g_object_unref()`

Since 0.4.0

### gdata_documents_spreadsheet_download_document ()

    GFile *             gdata_documents_spreadsheet_download_document
                                                            (GDataDocumentsSpreadsheet *self,
                                                             GDataDocumentsService *service,
                                                             gchar **content_type,
                                                             GDataDocumentsSpreadsheetFormat export_format,
                                                             gint gid,
                                                             GFile *destination_file,
                                                             gboolean replace_file_if_exists,
                                                             GCancellable *cancellable,
                                                             GError **error);

Downloads and returns the spreadsheet file represented by the GDataDocumentsSpreadsheet. If the document doesn't exist, `NULL` is returned, but no error is set in `error`. TODO: What?

If `cancellable` is not `NULL`, then the operation can be cancelled by triggering the `cancellable` object from another thread. If the operation was cancelled, the error `G_IO_ERROR_CANCELLED` will be returned.

When requesting a `GDATA_DOCUMENTS_SPREADSHEET_CSV` or `GDATA_DOCUMENTS_SPREADSHEET_TSV` file you must specify an additional parameter called `gid` which indicates which grid, or sheet, you wish to get (the index is `0`-based, so GID `1` actually refers to the second sheet on a given spreadsheet).

If `destination_file` is a directory, then the file will be downloaded in this directory with the "title" with the apropriate extension as name.

If there is an error getting the document, a `GDATA_SERVICE_ERROR_PROTOCOL_ERROR` error will be returned.

`self` : | a GDataDocumentsSpreadsheet
`service` : | a GDataDocumentsService
`content_type` : | return location for the document's content type, or `NULL`; free with `g_free()`. [out callee-allocates][transfer full][allow-none]
`export_format` : | the format in which the spreadsheet should be exported
`gid` : | the `0`-based sheet ID to download, or `-1`
`destination_file` : | the GFile into which the spreadsheet file should be saved
`replace_file_if_exists` : | `TRUE` if the file should be replaced if it already exists, `FALSE` otherwise
`cancellable` : | optional GCancellable object, or `NULL`
`error` : | a GError, or `NULL`
Returns : | the document's data, or `NULL`; unref with `g_object_unref()`. [transfer full]

Since 0.4.0

### gdata_documents_spreadsheet_get_download_uri ()

    gchar *             gdata_documents_spreadsheet_get_download_uri
                                                            (GDataDocumentsSpreadsheet *self,
                                                             GDataDocumentsSpreadsheetFormat export_format,
                                                             gint gid);

Builds and returns the download URI for the given GDataDocumentsSpreadsheet in the desired format. Note that directly downloading the document using this URI isn't possible, as authentication is required. You should instead use `gdata_download_stream_new()` with the URI, and use the resulting GInputStream.

When requesting a `GDATA_DOCUMENTS_SPREADSHEET_CSV` or `GDATA_DOCUMENTS_SPREADSHEET_TSV` file you must specify an additional parameter called `gid` which indicates which grid, or sheet, you wish to get (the index is `0`-based, so GID `1` actually refers to the second sheet on a given spreadsheet).

`self` : | a GDataDocumentsSpreadsheet
`export_format` : | the format in which the spreadsheet should be exported when downloaded
`gid` : | the `0`-based sheet ID to download, or `-1`
Returns : | the download URI; free with `g_free()`

Since 0.5.0