I have an excel file that I am trying to read and then display the values of the headers in a drop down. The first row in my excel file has all of the values (header names).
I used the code below, but what happens is that all the header names appear in a single line with commas. I want the headers to be separated, so that it will appear in the drop down with many <option>
, instead of a single <option>
. How do I do that?
<!-- Read the header values from excel -->
<cfset spreadsheet = "uploads/spreadsheet.xlsx">
<cfspreadsheet action="read" headerrow="1" src="uploads/spreadsheet.xlsx" query="excelHeader" rows="1" />
<cfset excelHeaders = excelHeader.columnList>
<!-- Display the header names as a dropdown -->
<select name="id_headers">
<option>
#excelHeaders#
</option>
</select>