Skip to content

Latest commit

 

History

History
37 lines (31 loc) · 1.02 KB

create-chart.md

File metadata and controls

37 lines (31 loc) · 1.02 KB

Create Chart

➡️ See the sendTo API documentation for general usage and all available commands. The create chart feature creates a chart from a data range in a sheet.

Used API endpoint: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate

The feature accepts the following parameters:

  • sheet: The name of the sheet.
  • chart: A chart configuration object with title, chartType, range, and optional position.
  • alias (optional): The spreadsheet alias if you have multiple spreadsheets configured.

Callback result: { success: true } on success, or { error: string } on failure.

Javascript

sendTo(
  'google-spreadsheet.0',
  'createChart',
  {
    sheet: 'Sheet1',
    chart: {
      title: 'Temperature',
      chartType: 'line',
      range: 'A1:B10',
      position: { row: 1, column: 4, width: 640, height: 360 },
      xAxis: 'Date',
      yAxis: '°C',
    },
    alias: 'main',
  },
  response => {
    console.log(response);
  },
);