Solved

Excel and XML -- exporting sheets and lists of lists.

Posted on 2004-08-12
7
799 Views
Last Modified: 2008-01-16
My company is using an excel spreadsheet for data capture.  The sheet has complex relationships (lists of lists) and multiple tabs of data within the excel file.  Excel in Office 2003 has the ability to export data to an .xml file, provided an .xsd is used to create a map.  The problem is the (relative) complexity of the data.  The first issue is with the excel sheet tabs; can a repeating element be mapped from each tab, where each tab is an instance of that element?  The second issue is the mapping of “lists of lists”.  

Is it possible to export repeating elements which contain repeating elements?  I’ve been unsuccessful so far, though it doesn’t seem like it should be difficult to do.  This seems to be a simple matter of being able to nest a child XML element under a parent from the EXCEL sheet, but Excel doesn't seem to be able to do that, at least not from the mapping provided.

Any info would help, thanks!
0
Comment
Question by:c4labb
  • 3
  • 2
7 Comments
 
LVL 26

Expert Comment

by:rdcpro
ID: 11785947
Since you're using Office 2003, can I suggest using InfoPath rather than Excel?  InfoPath is MUCH better at this than Excel, and is way easier to use--especially with complex data structures.  I've been creating some pretty nifty stuff lately with it.  I give it both thumbs up (leaving my fingers free to type!  ;^)

Regards,
Mike Sharp
0
 

Author Comment

by:c4labb
ID: 11786014
Thanks for feedback -- we did entertain using InfoPath.  

However our [internal] clients were familiar with the format of the Excel spreadsheet and were comfortable using it... that we've been pretty much mandated to use the current sheets with major updates baseline on our [tight] timelines.
0
 
LVL 26

Expert Comment

by:rdcpro
ID: 11786344
I assume you've looked at this:

http://office.microsoft.com/training/training.aspx?AssetID=RC011310531033&CTT=3&Origin=HP030737771033

I haven't gone through this myself, but it looked like it might be helpful.

It seems to me that the first task would be to create the Schema that has the structure you want, then map it to the appropriate places.  But if you can't create a schema and map it to Excel the way you want, you may be forced to post-process the XML from the spreadsheet using an XSLT transform to get it into the format you want.  

It's a pity your internal customers won't embrace InfoPath here...It offers some things you just can't get with Excel.  Multiple views are analogous to tabs, and repeating sections and tables are similar to your list of lists.  

Regards,
Mike Sharp

0
 

Author Comment

by:c4labb
ID: 11786948
Thanks for the link.  The example they use (and it's all over Microsoft) is a very basic expense report, with one section of one-to-one mapped data and one repeating section.  I'm wondering if multi-level repeating groups are possible at all from Excel.

And the post-processing via XSLT is a given regardless.  Unfortunately, if Excel does not like the structure of the .xsd due to complexity, it will not export to XML at all.  This is even in this case: I created what the final XML should look like, with the nested repeating elements.  I opened the XML with Excel, selecting the "open as XML list" option, which caused Excel to create its own schema.  The data displayed in flattened format in Excel, and it was even mapped for me.  HOWEVER, when I clicked "export" in the data/xml menu... it would not do it!  And this was due to "lists of lists", even when the schema had been created and mapped by Excel itself!

Very frustrating indeed.  Again, thanks for the responses.
0
 
LVL 26

Accepted Solution

by:
rdcpro earned 125 total points
ID: 11787723
Oh, that's a problem.  I mean, you can deal with flattened XML very easily in XSLT with Muenchian Grouping, but if Excel won't even create it...

You'll probably have to create your own schema, I think.  It does seem clear that Excel can't handle it automatically.  Even then, it might not work in Excel.  I just ran into a similar issue yesterday with InfoPath; that is, nested repeating elements.  But I created a custom schema, and InfoPath handled it just fine.  Good luck!  

Regards,
Mike Sharp

0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now