User Guide Cancel

StreamingspreadsheetNew

 

Disclaimer

Some older methods for reading and writing spreadsheets may not work for streaming spreadsheet objects if they attempt to operate on rows that are not yet loaded into memory at the time of invocation.

Description

Creates a streaming spreadsheet, which represents a single sheet of an Excel document.

Returns 

A spreadsheet object with streaming capabilities for read/write/update operations. 

History

  • ColdFusion (2025 release): Added the function.

Syntax

streamingSpreadsheetNew(sheetName, randomAccessWindowSize
streamingSpreadsheetNew(sheetName, randomAccessWindowSize
streamingSpreadsheetNew(sheetName, randomAccessWindowSize

Parameters

Name

 

 

Required

 

 

Type

 

 

Description

 

 

sheetName

 

 

No

 

 

String

 

 

The name of the sheet to be created.

If you do not specify any parameter, a sheet with the name sheet1 is created.

randomAccessWindowSize

 

 

No

 

 

Integer

 

 

The number of rows to be kept in memory at a time. The default value is 100.
Note:

If you do not specify any parameter, a sheet with the name sheet1 is created having size = 100

Example

<cfscript>
theFile=GetDirectoryFromPath(GetCurrentTemplatePath()) & "streamingSpreadsheetNewDoc.xlsx";
obj = streamingSpreadsheetNew("Sheet 1",100)
SpreadsheetSetCellValue(obj,"365",1,4);
// write values to the spreadsheet
spreadsheetwrite(obj, theFile,"",true,false);
</cfscript>
<cfscript> theFile=GetDirectoryFromPath(GetCurrentTemplatePath()) & "streamingSpreadsheetNewDoc.xlsx"; obj = streamingSpreadsheetNew("Sheet 1",100) SpreadsheetSetCellValue(obj,"365",1,4); // write values to the spreadsheet spreadsheetwrite(obj, theFile,"",true,false); </cfscript>
<cfscript> 
   theFile=GetDirectoryFromPath(GetCurrentTemplatePath()) & "streamingSpreadsheetNewDoc.xlsx"; 
   obj = streamingSpreadsheetNew("Sheet 1",100) 
   SpreadsheetSetCellValue(obj,"365",1,4); 
   // write values to the spreadsheet 
   spreadsheetwrite(obj, theFile,"",true,false);    
</cfscript> 
Output from streamingSpreadsheetNew function
Output from streamingSpreadsheetNew function

The next example shows the usage of randomAccessWindowSize of 10.

<cfscript>
theFile=GetDirectoryFromPath(GetCurrentTemplatePath()) & "streamingSpreadsheetNewDoc.xlsx";
obj = streamingSpreadsheetNew("Sheet 1",10)
SpreadsheetSetCellValue(obj,"365",1,4);
spreadsheetwrite(obj, theFile,"",true,false);
</cfscript>
<cfscript> theFile=GetDirectoryFromPath(GetCurrentTemplatePath()) & "streamingSpreadsheetNewDoc.xlsx"; obj = streamingSpreadsheetNew("Sheet 1",10) SpreadsheetSetCellValue(obj,"365",1,4); spreadsheetwrite(obj, theFile,"",true,false); </cfscript>
<cfscript> 
   theFile=GetDirectoryFromPath(GetCurrentTemplatePath()) & "streamingSpreadsheetNewDoc.xlsx"; 
   obj = streamingSpreadsheetNew("Sheet 1",10) 
   SpreadsheetSetCellValue(obj,"365",1,4); 
   spreadsheetwrite(obj, theFile,"",true,false); 
</cfscript> 

Get help faster and easier

New user?