XML template for better Excel export

Created on 12 July 2013, over 11 years ago
Updated 8 March 2023, almost 2 years ago

This approach provides an XML template that can be natively imported with Excel.

For a client I needed to export data from views into XML and then opening the XML file with Excel. Views bonus' default template for exporting XML is good and can be used for this purpose (this even gives you some nice formatting in Excel). However, as soon as the client wanted some special formatting in the excel file, the template was not sufficient.

The attached Excel XML template allows you to do the following

  • import a view's data natively into excel without worries
  • calculations: in the spreadsheet footer, sums are calculated for colums that contain numbers (modify for your own calculations)
  • formatting: each row has a different color than the previous one (zebra stripes)
  • formatting: some number columns use the euro currency
  • formatting: float numbers are formatted as percentage (e.g. 3.4% - modify for your own style)

How to install:

  • install the module views_bonus
  • create a view with a feed display
  • set the feed's style to XML
  • copy this template to your theme folder (anyone knows how to have it in a module?)
  • open the view and export your XML, open with excel

The template is roughly configurable within the template code.

  • change the zebra stripe colours
  • change the type mapping (view column data type to excel data type)

Helpful in writing this template were Introduction to Excel XML by Brian Jones (Part 1 and Part 2) and MSDN Documentation of Excel XML.

(Sorry, this is tested only in D6 / views export 1.1)

πŸ“Œ Task
Status

Closed: outdated

Version

1.1

Component

Documentation

Created by

πŸ‡©πŸ‡ͺGermany organicwire

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024