---
title: "excelSetCurrentSheet"
canonical: "https://support.appfire.com/space/PSJ/15485015/excelSetCurrentSheet"
format: markdown
---
> Macro (aura-html)


|  |  |  |  |
| --- | --- | --- | --- |
| **Syntax** | excelSetCurrentSheet(workbookFID, worksheet_name_or_index) | **Package** | excel |
| **Alias** |  | **Pkg Usage** | setCurrentSheet(workbookFID, worksheet_name_or_index) |

## Description

> Macro (excerpt)
> 
> Specifies the current sheet by name or index that subsequent processes should use.

Specifies the current sheet by name or index that subsequent processes should use.

## Parameters

| Parameter name | Type | Required | Description |
| --- | --- | --- | --- |
| id | Integer | Yes | The id. |

## Return Type

**Boolean**

Returns true if the operation was successful, false otherwise.

## Example

Add a new row and data to an existing workbook.

```javascript
use "excel";
int fid = openWorkbook("snakes.xlsx");
setCurrentSheet(fid, "Venemous Snakes");
addRow(fid, 1);
setCurrentSheet(fid, "Non-Venemous Snakes");
addRow(fid, 1);
closeWorkbook(fid);
```

Result: A new row is first added to the Venemous Snake sheet then a new row is added to the Non-Venemous Snake sheet.

> ⚠️ Click [here](https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15483208) to download the workbook used in this example.

## See also

> Macro (contentbylabel)