Skip to main content

Set Range

Writes a range of cells to an Excel worksheet from a table object. This is the primary node for writing multiple cells efficiently.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is set to true, no error is caught when the project is executed even if a Catch node is used.

Input

  • Client Id - The client ID from the Connect node (optional if using direct credentials).
  • Workbook Id - The workbook ID from Get Workbook or Create Workbook node.
  • Worksheet Name - Name of the worksheet to write to (e.g., Sheet1). Default is "Sheet1".
  • Start Cell - Starting cell address in A1 notation (e.g., A1, B5). The data will be written starting from this cell.
  • Range Data - Table object containing the data to write. Must have columns and rows properties.

Options

  • Credentials - OAuth2 credentials (optional, alternative to using Client ID).
  • Headers - When true, matches data columns to existing headers in the worksheet. When false, writes data sequentially starting from Start Cell. Default is false.

Output

This node doesn't produce output variables but writes data directly to the Excel file.

Examples

Write Data Sequentially:

// Input
Worksheet Name: "Sheet1"
Start Cell: "A1"
Headers: false
Range Data: {
"columns": ["Name", "Age", "City"],
"rows": [
{ "Name": "John", "Age": 30, "City": "New York" },
{ "Name": "Jane", "Age": 25, "City": "Boston" }
]
}

// Result in Excel:
// A1: John | B1: 30 | C1: New York
// A2: Jane | B2: 25 | C2: Boston

Write with Header Matching:

// Existing Excel headers:
// A1: City | B1: Name | C1: Age

// Input
Start Cell: "A2" // Start writing data from row 2
Headers: true
Range Data: {
"columns": ["Name", "Age", "City"],
"rows": [
{ "Name": "John", "Age": 30, "City": "New York" }
]
}

// Result in Excel:
// A1: City | B1: Name | C1: Age (existing headers)
// A2: New York | B2: John | C2: 30 (matched to headers)

Export Data to Excel:

Process Data (create table)
→ Create Workbook (create new file)
→ Set Cell Value (write headers)
→ Set Range (write data rows)

Update Existing Data:

Get Workbook
→ Get Range (read existing data)
→ Transform Data (process/update)
→ Set Range (write back)

Table Object Format

The Range Data must be a table object:

{
"columns": ["column1", "column2", "column3"],
"rows": [
{ "column1": "value1", "column2": "value2", "column3": "value3" },
{ "column1": "value4", "column2": "value5", "column3": "value6" }
]
}

Headers Option Behavior

Headers = false (Sequential Writing):

  • Writes data in column order from the table
  • Starts at Start Cell and fills right and down
  • Ignores existing headers
  • Faster for new data

Headers = true (Header Matching):

  • Reads existing headers from row 1
  • Matches table columns to worksheet headers
  • Writes each column to the correct position
  • Useful for updating existing structured data
  • Data rows start from the row specified in Start Cell

Use Cases

  • Export processed data to Excel
  • Bulk update Excel cells
  • Write calculation results
  • Generate reports in Excel format
  • Migrate data to Excel from other sources
  • Create data exports

Tips

  • For best performance, write data in batches using Set Range rather than individual cells
  • The table object can come from Get Range, database queries, or data transformations
  • Use Headers = false when creating new sheets with your own structure
  • Use Headers = true when updating existing formatted worksheets
  • Start Cell determines where data writing begins
  • All data writes are automatically saved - no separate save operation needed

Common Errors

ErrInvalidArg - "Workbook ID cannot be empty"

  • Solution: Ensure you've called Get Workbook first

ErrInvalidArg - "Range data cannot be empty"

  • Solution: Provide a table object with columns and rows arrays

ErrInvalidArg - "Range data is empty"

  • Solution: Ensure the table object has at least one column and one row

ErrNotFound - "Worksheet not found"

  • Solution: Verify the worksheet name is correct

ErrGraph - "Microsoft Graph Error"

  • Solution: Check that you have write permissions to the file