Solved

Import XML data into one row in Excel

Posted on 2014-01-07
10
3,128 Views
1 Endorsement
Last Modified: 2014-02-20
Hello,
     I have an XML data that I would like to import into Excel. The data as provided by the client looks like this:

<?xml version="1.0" encoding="UTF-8" ?>
<Batch>
<Package>
<TemplateID>PROV1</TemplateID>
<Entity_ID>0000000245</Entity_ID>
<Date>20140106</Date>
<Batch_ID>01</Batch_ID>
.
.
.
</Package>

<Package>
<TemplateID>PROV1</TemplateID>
<Entity_ID>0000000999</Entity_ID>
<Date>20140106</Date>
<Batch_ID>01</Batch_ID>
.
.
.
</Package>
<Batch>

Open in new window

There are more fields in Package, but that's the gist. Each "Package" has the data, so what I would like to do is have all the items in each package be the column headers, and then the data from each package to populate under that. When I try importing, the data is imported, but each new field is put in a new row, so the data looks as though it it diagonal. How can I import all the data in one row?

Thank you!
1
Comment
Question by:indigo6
  • 5
  • 5
10 Comments
 
LVL 39

Expert Comment

by:als315
ID: 39763079
Have you tried direct import from XML file with master? Open Data Tab:
Data tabPress From Other Sources and select XML:
xmlResult looks like:
resultMay be you have errors in your file?
Sample file is attached
test.xml
0
 

Author Comment

by:indigo6
ID: 39763100
Hmm, maybe it's something with Excel 2013? I tried those steps and I get the following message: "The specified XML source does not refer to a schema..." So I let it generate a schema and it comes out diagonally.
0
 
LVL 39

Expert Comment

by:als315
ID: 39764235
Can you upload your file? There is an error in your sample: last line should be </Batch> instead of <Batch>.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:indigo6
ID: 39765997
I'd have to strip all the data out of it. But the closing tag error is not in the original document, I made that error when I made the sample.
0
 
LVL 39

Expert Comment

by:als315
ID: 39776797
Is you question actual? Do you have sample xml file? Have you tried to import my sample?
0
 

Author Comment

by:indigo6
ID: 39777356
I think there is an issue with another tag somewhere, because your sample works fine. What could cause the data to import diagonally?
0
 
LVL 39

Accepted Solution

by:
als315 earned 500 total points
ID: 39778550
Yes, of course. When you have no schema, Excel try to build it, analyze one (?) tag and if in next tag are additional positions, import may go wrong. That's why I ask for sample. You can divide your file into parts, import them separately and find problem part. If there are extra fields, you can add them as empty to first Package tag.
0
 

Author Comment

by:indigo6
ID: 39795521
Yes, I ended up having multiple fields with the same name. These fields are actually subfields, but that's ok. Is there a way to tell Excel to concatenate the data in two fields if they have the same name?
0
 
LVL 39

Expert Comment

by:als315
ID: 39797831
You have no options in xml import, you can only use VBA for import as a text file. But I can't reproduce this problem. Can you upload sample file?
0
 

Author Closing Comment

by:indigo6
ID: 39874373
I had an issue with the import file. Thanks!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

773 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