Tags · Functions · Objects
Lucee Tag Reference
Choose a tag:

Tag <CFSPREADSHEET>

Handles spreadsheets

Body

This tag may have a body.

Example

	<cfspreadsheet
		action="string"
		[columnformats="struct"]
		[columnnames="any"]
		[columns="any"]
		[excludeheaderrow="any"]
		[filename="any"]
		[format="any"]
		[headerrow="any"]
		[name="any"]
		[overwrite="any"]
		[password="any"]
		[query="any"]
		[readallsheets="any"]
		[rows="any"]
		[sheet="any"]
		[sheetname="any"]
		[sheetnameconflict="any"]
		[src="any"]>

	[</cfspreadsheet>]
	

Attributes

The attributes for this tag are fixed. Except for the following attributes no other attributes are allowed.
Name Type Required Description
action string Yes read:Reads the contents of an XLS format file. update: Adds a new sheet to an existing XLS file. You cannot use the update action to change an existing sheet in a file. For more information, see Usage. write: Writes a new XLS format file or overwrites an existing file. 
columnformats struct No Applies only when using a query with action 'Write' or 'Update'. A structure of structures containing custom formats for one or more query columns 
columnnames any No Comma-separated column names. 
columns any No Column number or range of columns. Specify a single number, a hypen-separated column range, a comma-separated list, or any combination of these; for example: 1,3-6,9. 
excludeheaderrow any No If set to true, excludes the headerrow from being included in the query results.The attribute helps when you read Excel as a query. When you specify the headerrow attribute, the column names are retrieved from the header row. But they are also included in the first row of the query. To not include the header row, set true as the attribute value. 
filename any No The pathname of the file that is written. 
format any No Format of the data represented by the name variable. All: csv On read, converts an XLS file to a CSV variable. On update or write, Saves a CSV variable as an XLS file. Read only: html Converts an XLS file to an HTML variable. The cfspreadsheet tag always writes spreadsheet data as an XLS file. To write HTML variables or CSV variables as HTML or CSV files, use the cffile tag. 
headerrow any No Row number that contains column names. 
name any No read action: The variable in which to store the spreadsheet file data. Specify name or query. write and update actions: A variable containing CSV-format data or an ColdFusion spreadsheet object containing the data to write. Specify the name or query. 
overwrite any No A Boolean value specifying whether to overwrite an existing file. 
password any No Set a password for modifying the sheet. Note: Setting a password of the empty string does no unset password protection entirely; you are still prompted for a password if you try to modify the sheet. 
query any No read action: The query in which to store the converted spreadsheet file. Specify format, name, or query. write and update actions: A query variable containing the data to write. Specify name or query. 
readallsheets any No Applies only to action 'Read'. If true, read all sheets in the workbook and ignore 'SheetName' and 'Sheet' values 
rows any No The range of rows to read. Specify a single number, a hypen-separated row range, a comma-separated list, or any combination of these; for example: 1,3-6,9. 
sheet any No Number of the sheet. For the read action, you can specify sheet or sheetname. 
sheetname any No Name of the sheet For the read action, you can specify sheet or sheetname. For write and update actions, the specified sheet is renamed according to the value you specify for sheetname. 
sheetnameconflict any No Applies only to action 'Update'. Action to take if the requested sheetName alread exists.
  • Error: Stop processing and return an error
  • Overwrite: Replace the existing sheet. All data within the sheet is deleted.
 
src any No The pathname of the file to read.