rename method

void rename(
  1. String oldSheetName,
  2. String newSheetName
)

Changes the name from oldSheetName to newSheetName.

In order to rename : oldSheetName should exist in excel.tables.keys and newSheetName must not exist.

Implementation

void rename(String oldSheetName, String newSheetName) {
  if (_sheetMap[oldSheetName] != null && _sheetMap[newSheetName] == null) {
    ///
    /// rename from _defaultSheet var also
    if (_defaultSheet == oldSheetName) {
      _defaultSheet = newSheetName;
    }

    copy(oldSheetName, newSheetName);

    ///
    /// delete the `oldSheetName` as sheet with `newSheetName` is having cloned `SheetObject of oldSheetName` with new reference,
    delete(oldSheetName);
  }
}