Reputation: 289
So most SO answers I've found for exporting data to excel involve using URIs with data:
. Is this the best client-side way of doing it (at least on Windows, it doesn't seem to work with Macs)?
Upvotes: 0
Views: 241
Reputation: 5460
If you don't mind the client requirement of flash, you can use Downloadify.
Also, if PhD's answer was the one you used, you might want to give his answer the 'accepted' check :)
Upvotes: 0
Reputation: 11334
So most SO answers I've found for exporting data to excel involve using URIs with
data:
Err...what do you mean and can you provide some links please?
That aside there are various ways you can do it - choose the one most appropriate. One way is what you mention (I can't understand it unless you post some links).
Another way: Arrange all your data as a multi-line csv string:
a, b, c, d
e, f, g, h, i
...
and send it to the server. The server 'service' just takes this string and returns a CSV representation which will be correctly downloadable. That is take the string paste in a file by the name 'myfile.csv' and return the file to the user.
Yet another way (hacky): Show a textarea with the CSV "in" it and ask the user to copy/paste it into Excel. CSVs are easily split into multiple columns on copy-paste.
If you are using Google Spreadsheets - then you could populate the text area with TSV (Tabbed Space Values) i.e. a tab \t
separates two columns instead of a comma. A copy/paste into Google spreadsheets would be across columns
Use whatever approach suits you best. Know your goals (i.e. the why) before selecting an approach and the value/worth of that approach after selection.
Upvotes: 1