a generic question, what could be the best approac...
# cfml-general
g
a generic question, what could be the best approach to download trillion of data in excel with coldfusion, i know it could kill server but checking if something we can work on, like cfexecute or execing any perl script or anything else maybe building a cmd script
a
Does it have to be Excel? Can you use CSV instead (which you can open in Excel)
g
csv will work, but will it those many records
without kiiliing server
a
So writing the file is probably not the issue, the issue will be getting that data in the first place to process it. Where is that data coming from?
g
sql server so we run a query to fetch it
a
SQL server can export directly to Excel I believe so you might want to look into those tools.
g
i read about it, using ssis or something directly from excel, but my question if i did a button press from front end then it is going through cf server correct
then sql can do it from there end,
and just senbd me a csv files by generating it directly ?
a
That's quite old that answer but hopefully puts you on the right track. That way CF isn't involved in having to get loads of data and then write it to a file. SQL server is doing the heavy lifting instead.
g
ok
a
This looks like a newer way to do it (I've not tried) https://stackoverflow.com/a/68989909
e
You will find with large datasets as the file grows your application will begin to crash or cause massive resource errors on your server. The workaround is to split your csv files to a reasonable size, then merge them using the cat command. Reasonable is based upon your server hardware and storage, but 1 GB is the limit I stick with. ie dump your report to "report-build-out" which may have 1.csv , 2,csv ... 500.csv Then run "cat 1.csv, 2.csv, ectra > /path/to/report/complete.csv
g
nice thanks everyone
m
for creating spreadsheets that are fairly large https://blog.simplicityweb.co.uk/120/generating-large-spreadsheets-more-efficiently-using-sxssf has worked for us. But most likely anything really large is not going to be compatible with excel.
q
Remember, Excel is limited to 65,000 rows... even if opening CSV files. Anything more than that you need to break it up anyway.
a
modern Excel is NOT limited to 65,000 rows. That was the old format of
xls
. .xlsx, .xlsm or .xlsb workbooks can store significantly more but I think there is still a limit as you probably won't be able to open it as it's too large!
BTW: I think Excel is a terrible format for data transfer, end clients uses it so we have to export in that format but it causes so many headaches