Whatever message this page gives is out now! Go check it out!

spreadsheetGetLastRowNumber

Last update:
May 18, 2026

Description

Retrieves the row number of the last row of the spreadsheet.

Returns

An integer representing the last row of the spreadsheet.

History

  • ColdFusion (2025 release): Added the function.

Syntax

spreadsheetGetLastRowNumber(spreadSheetObject)

Parameters

Name
Required
Type
Description
spreadSheetObject
Yes
ExcelInfo
The Excel spreadsheet object from which to retrieve the last row number.

Example

<cfquery name="art" datasource="cfartgallery">
    SELECT * FROM ART
</cfquery>
<cfscript>
    theFile=GetDirectoryFromPath(GetCurrentTemplatePath()) & "art-col.xls";
    // create a spreadsheet object
    theSheet=spreadsheetNew("SampleData")
    // add rows from the table to the spreadsheet
    spreadsheetAddRows(theSheet,art)
    // write the spreadsheet
    spreadsheetWrite(theSheet,theFile,"yes")
    // get last row number
    lastRowNumber=spreadsheetGetLastRowNumber(theSheet)
    writeOutput("The last row number is: " & lastRowNumber)
</cfscript>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page