Skip to main content

Robot Task Activities - Excel Cell​

The Excel Cell activities read, write, copy, merge and clear cells on the active worksheet.

The Excel Cell category in the activity list, from Activate Cell to Paste to Cell

All activities in this category must be inside a New Excel or Attach to Excel container activity. See Excel. They act on the active worksheet, so use an Excel Sheet Activate Sheet activity first when the workbook has more than one sheet.

Address fields take a cell or a range of cells, such as A4 or A1:B1. See the Excel Range reference. Variables are resolved in every field.

warning

With DisplayAlerts cleared on the parent container, which is the default, Excel deletes and overwrites without asking. Save the workbook before you change its structure.

Selecting a cell: click the Click to select Excel element link to pick a cell in Excel and fill in the address automatically. Excel must already be running.


Activate Cell​

Activates the cell.

The Activate Cell activity, with the Click to select Excel element link and the Address field

  • Address: the cell or range of cells

Select Address​

Selects the cell or range. Same field as Activate Cell.


Select all Cells​

Selects all cells in the active worksheet.


Set Cell value​

Writes a value to the cell or range.

The Set Cell value activity, with the Address and Value fields

  • Address: the cell or range of cells
  • Value: the value written to the cell, or to every cell of the range

Both fields accept Variables, so the target address and the value can both be set at runtime. This is how a loop writes each record to the next free row.


Get Cell value​

Reads the value of the cell or range and saves it to a Job or User Variable.

The Get Cell value activity, with the Address, Variable type and Variable fields

  • Address: the cell or range of cells
  • Variable type: "Job" or "User"
  • Variable: the name of the Variable that receives the value

For a range, the values are returned as one text value: the cells of a row are separated by tab characters, and each row is on a new line.


Clear Cell​

Clears the cell or range: its value, its formula and its formatting. Same field as Activate Cell.


Delete Cell​

Deletes the cell or range, and shifts the surrounding cells to fill the gap. Same field as Activate Cell.

The difference from Clear Cell is that Delete Cell removes the cells and moves the cells around them, whereas Clear Cell empties the cells and leaves the others where they are.


Insert Cell​

Inserts a cell or range at the address, and shifts the existing cells to make room. Same field as Activate Cell.


Copy Cell​

Copies the cell or range to another place.

The Copy Cell activity, with the Source and Destination fields

  • Source: the cell or range to copy
  • Destination: the cell or range the source is copied to; what was there is overwritten

Cut Cell​

Moves the cell or range to another place. Same fields as Copy Cell.


Merge Cells​

Merges the cells of the block that runs from the Source cell to the Destination cell into one cell. Same fields as Copy Cell.


Unmerge Cells​

Splits a merged cell back into separate cells.

  • Source: the merged cell or range

Paste to Cell​

Pastes the clipboard content at the cell or range. Same field as Activate Cell.

This activity pastes what is on the Windows clipboard, so it pairs with an earlier copy, such as a copy made in Excel. Test it with your data before relying on it for text placed on the clipboard by the Clipboard Set Clipboard activity.


Tips​

  • Build the Address from a loop iteration variable to write successive rows, for example A{RPALOOP(a381|Iterations)}. See Loops
  • Write the header row with individual Set Cell value activities at the start of the Task, before the loop begins, so that the exception log has column names. See Data Processing & Logging
  • Write a range in one Set Cell value activity where the value is the same across the range, rather than one activity per cell
  • To put a range into separate Variables, read the cells one at a time with Get Cell value
  • Clear Cell also removes formatting. To reset a formatted template, write empty values with Set Cell value instead, and avoid Delete Cell, which moves the surrounding cells and breaks the layout