User Guide Cancel

spreadsheetRenameSheet

 

Description

Renames a sheet in a spreadsheet.xf

Returns

None 

History

  • ColdFusion (2025 release): Added the function.

Syntax

SpreadsheetRenameSheet( Object spreadsheet, String oldName, String newName)
SpreadsheetRenameSheet( Object spreadsheet, String oldName, String newName)
SpreadsheetRenameSheet( Object spreadsheet, String oldName, String newName)

Parameters

Name

 

 

Required

 

 

Type

 

 

Description

 

 

spreadSheetObject

 

 

Yes

 

 

ExcelInfo 

 

 

The Excel spreadsheet object where a sheet must be renamed.

 

oldName

 

 

Yes

 

 

String 

 

 

The sheet to be renamed.

 

 

newName

 

 

Yes

 

 

String 

 

 

The new name of the sheet.

 

 

Example

<cfscript>
// set the path of the file
theFile=GetDirectoryFromPath(GetCurrentTemplatePath()) & "art-source.xls";
// create the spreadsheet naming the first worksheet as Course
obj =SpreadsheetNew("Course")
// create the second worksheet
SpreadsheetCreateSheet (obj,"Marks");
// create the third worksheet
SpreadsheetCreateSheet (obj,"EvaluationSheet");
spreadsheetWrite(obj, "#theFile#", "", "yes", "no")
obj1 =SpreadsheetRead(#theFile#)
spreadsheetRenameSheet(obj1,"Marks","MarksRenamed")
writeDump(obj1)
writeOutput(obj1.SUMMARYINFO.SHEETNAMES)
</cfscript>
<cfscript> // set the path of the file theFile=GetDirectoryFromPath(GetCurrentTemplatePath()) & "art-source.xls"; // create the spreadsheet naming the first worksheet as Course obj =SpreadsheetNew("Course") // create the second worksheet SpreadsheetCreateSheet (obj,"Marks"); // create the third worksheet SpreadsheetCreateSheet (obj,"EvaluationSheet"); spreadsheetWrite(obj, "#theFile#", "", "yes", "no") obj1 =SpreadsheetRead(#theFile#) spreadsheetRenameSheet(obj1,"Marks","MarksRenamed") writeDump(obj1) writeOutput(obj1.SUMMARYINFO.SHEETNAMES) </cfscript>
<cfscript>
    // set the path of the file
    theFile=GetDirectoryFromPath(GetCurrentTemplatePath()) & "art-source.xls";
    // create the spreadsheet naming the first worksheet as Course
    obj =SpreadsheetNew("Course")
    // create the second worksheet
    SpreadsheetCreateSheet (obj,"Marks");
    // create the third worksheet
    SpreadsheetCreateSheet (obj,"EvaluationSheet");
    spreadsheetWrite(obj, "#theFile#", "", "yes", "no")
    obj1 =SpreadsheetRead(#theFile#)
    spreadsheetRenameSheet(obj1,"Marks","MarksRenamed")
    writeDump(obj1)
    writeOutput(obj1.SUMMARYINFO.SHEETNAMES)
</cfscript>

Get help faster and easier

New user?