Menu

insertRowValues

This command requires extra license.

A child command for modifyWorkbook that will, through its own child commands, set values into one or multiple cells of the specified row. Any cell content on the specified row or below it (ie. has higher row index) on or between the columns that are being modified get shifted one row downwards, so insertRowValues will never overwrite any existing cell content.

Parent commands

  • modifyWorkbook
    Required. This parent defines the workbook that is modified.

Child commands

  • rowCell
    Required. At least one of these child commands is required to set a new value for a cell in the specified row.

Attributes

row

Required
Value type
EL-evaluated
Yes Number Yes
Defines the row whose cells will be modified by the child commands. The resolved value is expected to be a row index Number, with the first row having the index of 1. 
sheet

Required
Value type
EL-evaluated
Yes String Yes
Defines the sheet where the target row is in. The resolved String is expected to be a name of a sheet in the workbook.

Examples

As insertRowValues provides a simple way to setting values into multiple cells of a row, it pairs well with forEach for producing multiple content-filled rows. One could, for example, make rows out of Salesforce query results - the following goes through a Collection of Opportunity records, setting the Name and Amount of each Opportunity onto its own row. The Loop status provided by forEach is used to generate the sequential row indexes, with the first row to modify in this example being row 4.

<forEach value="${opportunities}" var="opp" varStatus="status">
  <insertRowValues row="${status.count + 3}" sheet="Sheet1">
    <rowCell column="A" value="${opp.Name}"/>
    <rowCell column="C" value="${opp.Amount}"/>

Any existing cell content on the sheet that are on row 4 or below on columns A, B or C are shifted down as many rows as there are Opportunities to loop through. Any content on those rows on any other column would remain in place.

Comments

0 comments