portal entry

select a category, or use search below
(searches all categories and all time range)
Title:

CFLOCATION with an Excel SPreadsheet

| View in Portal
August 31, 2020 04:13:17 PM GMT
4 Comments
<p>I have a 21,000 row spreadsheet that when I use a cflocation tag <cflocation url=”#filename#”> pointing to the spreadsheet, it does not prompt to open or save the spreadsheet, it simple displays an empty page.  The spreadsheet is created by a query and if I change the query to top 8000,  the cflocation works.  Anything over 8,000 results in the empty page. Does anyone have a possible solution?</p>
<p>The post <a rel="nofollow" href="https://coldfusion.adobe.com/2020/08/cflocation-excel-spreadsheet/">CFLOCATION with an Excel SPreadsheet</a> appeared first on <a rel="nofollow" href="https://coldfusion.adobe.com">ColdFusion</a>.</p>
Labels: Discussion, Language, ColdFusion, discussion, language

Comments:

<p>How do you create the spreadsheet in the first place?</p>
Comment by Bernhard Döbler
7838 | August 31, 2020 09:06:48 PM GMT
How do you create the spreadsheet in the first place? Do you create a file in the filesystem? Is this file corrupt?
Comment by Bernhard Döbler
7837 | August 31, 2020 09:08:37 PM GMT
In summary, looping through a query I used <spreadsheetAddRow> to populate the rows.  After the query I used <cfspreadsheet> to save the spreadsheet.  I then used <cflocation url="#filename#"> which would typically prompt the user to open or save the file but in this case it doesn't.  The file itself is fine, I can open it in Excel and when I type the path in a URL, I get prompted to open or save it.
Comment by Randy Kramkowski
7840 | September 01, 2020 12:24:34 PM GMT
Hey Randy, You can use cfheader and cfcontent to deliver the file to the user within the same request. I would recommend using spreadSheetNew which can store the sheet to a variable and then you can deliver like follows: theSpreadsheet = spreadSheetNew("your-columns"); // all your code to add rows // deliver as follows cfheader(name="Content-Disposition", value="attachment; filename=name-of-file.xls"); cfcontent(type="application/vnd.ms-excel", variable=spreadSheetReadBinary(theSpreadsheet)); You can also just delivery the file you created in the physical drive as well.
Comment by Giancarlo Gomez
7841 | September 01, 2020 09:56:00 PM GMT