Export to Excel
| Project: | Views Bonus Pack |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
This patch addresses previous issues to provide an option to Export to Excel.
This is an updated port of the patch in Issue #444412 that has been updated to work with Views Bonus -6.x-1.x-dev as of July 07 2009. This patch only addresses the Excel Export function. See also Issue #262338.
The method for this export is via HTML Table. I believe this is the best method for the following reasons:
- Currencies - If a field value is formatted to show $10.99, Excel will see it as a Currency Field Format with value 10.99. This allows the field to be summed as a number.
- Hyperlinks - Excel will preserve any links in Views Fields. If this link is an Views Argument link, in Excel, you can click on the link and go directly to the web page.
- Text Formats - Bold, Italic, etc. will carry over to Excel.
All of these features make the HTML Table Excel export much more user friendly. Your users can start to use the export, email it and read it immediately. A direct data export like Views_Export _XLS does not persevere all of this info. You have to reformat all of the data in Excel before it's readable and usable.
This patch should be applied to sites/all/modules and will update the folder views_bonus inside of modules. You will need to copy the attached xls.png into the sites/all/modules/views_bonus/export/images.
| Attachment | Size |
|---|---|
| views_bonus.patch | 4.64 KB |
| xls.png | 378 bytes |

#1
Thanks, initial look at the patch seems pretty good. Will give it a closer look as time permits.
#2
your patch is rejected on attached file
#3
This patch shouldn't even touch views-bonus-export-csv.tpl. Not sure what problem you are having.
#4
Subscribing, and question:
Will this address issues with bullets (for example)?
I'm using WYSIWYG editors all over. Users enter in bulleted lists quite often. I show these in tabular views as one column. When exporting to CSV, the bullets turn into some funky characters and of course lose formatting (carriage returns?). Ideally, exporting to XLS would solve that and keep the bullets intact.
#5
Exporting automatically to excel without any patch is working fine for me.
Chose style as "doc file", and inside the parameters check "provide as file" and then change the proposed filename from "view-%view.doc" to "view-%view.xls"
It will then open excel instead of word, keeping the format fields.
#6
Any news about this project ?
Can't open any ;XLS file or whatsoever : seems that the export are not that good.
#7
Attached is an updated patch against the latest Dev snapshot.
#8
+1 vote for this patch or something similar
Export to CSV doesn't work in Excel if you have Unicode characters in your data. I needed to export a View to Excel and ended up going with a solution quite similar to this (before I discovered this patch existed.) For this reason, and those cited above, I think HTML-within-XLS is the best option.
#9
The patch is actually missing the template so it's not very reviewable. Everything else looks fine.
#10
Have any of you seen the following library: http://phpexcel.codeplex.com, it looks like a much better alternative to the library used in http://drupal.org/project/views_export_xls or the HTML table solution used in this patch.
Take a look at the features: http://phpexcel.codeplex.com/wikipage?title=Features&referringTitle=Home
#11
I've created a module which allows you to use PHP Excel with views if anyone is interested.