Documentation
¶
Overview ¶
Package excel is a client for the Microsoft Graph workbook API, which edits .xlsx files stored in OneDrive or SharePoint in place. A workbook is addressed by its drive id and item id, as resolved with the drive package.
Index ¶
- Constants
- type Client
- func (c *Client) AddTable(ctx context.Context, driveId string, itemId string, address string, ...) (*table.Table, error)
- func (c *Client) AddTableRows(ctx context.Context, driveId string, itemId string, tableName string, ...) (*table_row.TableRow, error)
- func (c *Client) CloseSession(ctx context.Context, driveId string, itemId string, sessionId string, ...) error
- func (c *Client) CreateSession(ctx context.Context, driveId string, itemId string, persistChanges bool, ...) (*session.Session, error)
- func (c *Client) GetRange(ctx context.Context, driveId string, itemId string, worksheet string, ...) (*workbook_range.Range, error)
- func (c *Client) ListTableRows(ctx context.Context, driveId string, itemId string, tableName string, ...) ([]*table_row.TableRow, error)
- func (c *Client) ListTables(ctx context.Context, driveId string, itemId string, ...) ([]*table.Table, error)
- func (c *Client) UpdateRange(ctx context.Context, driveId string, itemId string, worksheet string, ...) (*workbook_range.Range, error)
Constants ¶
const SessionIdHeader = "workbook-session-id"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(options ...excel_config.Option) *Client
func (*Client) AddTable ¶
func (c *Client) AddTable( ctx context.Context, driveId string, itemId string, address string, hasHeaders bool, options ...request_config.Option, ) (*table.Table, error)
AddTable creates a table over address, a range including its worksheet (e.g. "Sheet1!A1:D1"). With hasHeaders the range's first row becomes the header row; a header-only range makes an empty table to add rows to.
func (*Client) AddTableRows ¶
func (c *Client) AddTableRows( ctx context.Context, driveId string, itemId string, tableName string, values [][]any, options ...add_table_rows_config.Option, ) (*table_row.TableRow, error)
AddTableRows appends rows to the table identified by tableName (its name or id), growing it to fit. Each row needs one value per table column. Adding many rows in one call is much faster than one call per row.
func (*Client) CloseSession ¶
func (c *Client) CloseSession( ctx context.Context, driveId string, itemId string, sessionId string, options ...fetch_config.Option, ) error
CloseSession closes the session identified by sessionId.
func (*Client) CreateSession ¶
func (c *Client) CreateSession( ctx context.Context, driveId string, itemId string, persistChanges bool, options ...fetch_config.Option, ) (*session.Session, error)
CreateSession opens a workbook session. Running a series of calls in one is faster than running them sessionless; with persistChanges false their changes are discarded when it closes. Close it with CloseSession.
func (*Client) GetRange ¶
func (c *Client) GetRange( ctx context.Context, driveId string, itemId string, worksheet string, address string, options ...request_config.Option, ) (*workbook_range.Range, error)
GetRange retrieves the cells at address (e.g. "A1:C10") on the worksheet identified by worksheet (its name or id).
func (*Client) ListTableRows ¶
func (c *Client) ListTableRows( ctx context.Context, driveId string, itemId string, tableName string, options ...request_config.Option, ) ([]*table_row.TableRow, error)
ListTableRows retrieves the data rows of the table identified by tableName.
func (*Client) ListTables ¶
func (c *Client) ListTables(ctx context.Context, driveId string, itemId string, options ...request_config.Option) ([]*table.Table, error)
ListTables retrieves the workbook's tables.
func (*Client) UpdateRange ¶
func (c *Client) UpdateRange( ctx context.Context, driveId string, itemId string, worksheet string, address string, values [][]any, options ...request_config.Option, ) (*workbook_range.Range, error)
UpdateRange writes values to the cells at address on the worksheet; values must match the range's dimensions, and a nil value leaves its cell unchanged. A string starting with "=" is entered as a formula.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package request_config holds the options every workbook call takes.
|
Package request_config holds the options every workbook call takes. |
|
types
|
|