Came across some odd CFSPREADSHEET behavior in ColdFusion.
I was attempting to quickly export a query object to an Excel spreadsheet:
<cfset tmpXLSFile = "#getTempDirectory()#data_export.csv"> <cfspreadsheet action="write" overwrite="true" filename="#tmpXLSFile#" query="exportData">
ColdFusion kept throwing this strange error:
An exception occurred while using action="write" java.lang.NullPointerException
Everything seemed ok with my code and my query.
After some head scratching I noticed that my file variable had a .CSV extension. Changing this to XLS fixed the issue immediately:
<cfset tmpXLSFile = "#getTempDirectory()#data_export.xls"> <cfspreadsheet action="write" overwrite="true" filename="#tmpXLSFile#" query="exportData">
Not sure why ColdFusion cares about the file extension.
An information technology professional with twenty five years experience in systems administration, computer programming, requirements gathering, customer service, and technical support.
2 Comments