SpreadsheetAddRows

Adds multiple rows from a query to an Excel spreadsheet object.

Method Signature

SpreadsheetAddRows(spreadsheetObj=[any], data=[any], row=[any], column=[any], insert=[any], datatype=[any], includeColumnNames=[any])

Arguments

Argument
Type
Required
Description
Default

spreadsheetObj

ANY

true

The spreadsheet object.

data

ANY

true

An array of arrays or a query object to add as rows.

Examples

Add multiple rows from array of arrays:

// Add multiple rows at once
var spreadsheet = SpreadsheetNew();
var data = [
    [ "John", "Sales", 75000 ],
    [ "Alice", "Marketing", 65000 ],
    [ "Bob", "IT", 80000 ]
];
SpreadsheetAddRows( spreadsheet, data );

Add a query as spreadsheet rows:

// Convert query results to spreadsheet rows
var spreadsheet = SpreadsheetNew();
var employees = queryExecute( "SELECT name, department, salary FROM employees" );
SpreadsheetAddRows( spreadsheet, employees );

Batch import data:

// Import from external data source
var spreadsheet = SpreadsheetNew();

// Add headers
SpreadsheetAddRow( spreadsheet, [ "ID", "Product", "Price", "Stock" ] );

// Add bulk data
var products = [
    [ 1, "Widget", 19.99, 100 ],
    [ 2, "Gadget", 29.99, 50 ],
    [ 3, "Gizmo", 39.99, 75 ]
];
SpreadsheetAddRows( spreadsheet, products );

| row | NUMERIC | false | The row number where to start inserting the data (1-based). If not specified, adds to the end. | | | column | NUMERIC | false | The column number where to start inserting the data (1-based). Default is 1. | | | insert | BOOLEAN | false | Whether to insert new rows or overwrite existing rows. Default is false. | true | | datatype | BOOLEAN | false | The data type to apply to the cells (not implemented in this version). | false | | includeColumnNames | any | false | Whether to include column names as the first row. Default is false. | |

Examples

Last updated

Was this helpful?