[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Import XML file into Excel

Posted on 2010-11-15
10
Medium Priority
?
396 Views
Last Modified: 2012-05-10
Attached is a XML file and an Excel spreadsheet after I have imported this XML into it. Is it possible to rearrange the resulting spreadsheet so that the columns are Session#, SourceHost, SourcePath, StartTime, etc with the corressponding values listed by session #? Can this be done via the XML import process into Excel Or is VBA code necessary? Either way I would appreciate assistance. The current format is not manageable. Thanks.
BackUpJob1349.xml
Book3.xlsx
0
Comment
Question by:StampIT
  • 4
  • 4
  • 2
10 Comments
 
LVL 13

Expert Comment

by:gbanik
ID: 34137228
Use an XML parser to parse through the XML file and populate the Excel file. There may not be a straight forward way of achieving this. Use the Microsoft XML Library to do so.

Add it as reference in your project
http://msdn.microsoft.com/en-us/library/ms763701(VS.85).aspx

Check this to parse your data
http://msdn.microsoft.com/en-us/library/aa163921(office.10).aspx
0
 
LVL 7

Expert Comment

by:Bruce Cadiz
ID: 34138321
StampIT,

Here's a different approach by replacing your XML tags with HTML then opening in Excel.
Note: It will open the XML file and replace listed text string / tags with HTML tags then open in Excel. Seemed like the simplest approach since your XML was similarly structured to an HTML table.

Bruce ee-Q26615394.xls
0
 

Author Comment

by:StampIT
ID: 34140700
Thanks for the replies. Both of these are way over my head. I thought there might be a simpler way of performing this task.
Bruce: I ran your code with the file I had but it resulted in data in the first row in a language I did not understand. I probably did something wrong.
If I can I should probably withdraw the question.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 13

Expert Comment

by:gbanik
ID: 34140776
StampIT as I mentioned in my comment, there might not be a simpler way. But actually less difficult than u are thinking. This method is a tried and tested way and u can definitely give it a try.
I am confident about the direction.
0
 
LVL 7

Expert Comment

by:Bruce Cadiz
ID: 34140881
StampIT,

Here is your sample XML file and I've modified the Excel file to save the output in the same directory. It should do exactly what you have asked.

Save them to a folder that you have read/write access to. Then open the Excel file and hit the button to Select the XML File. You are running Windows aren't you? What version of Excel do you have?

Bruce ee-Example.zip
0
 

Author Comment

by:StampIT
ID: 34140958
Bruce,
      I am running Windows Vista and Excel 2007. Thanks
0
 
LVL 7

Accepted Solution

by:
Bruce Cadiz earned 2000 total points
ID: 34141334
StampIT,

Then it should work, (I'm running XP and Office 2003 SP3). The funny character output is a question mark in a weird character set on the first line (probably and XML creation error) but essentially it's what is in attached (HTML file). I've also included .jpg's of the output in Excel and the Error message for the weird character.

Bruce ee-files.zip
0
 

Author Closing Comment

by:StampIT
ID: 34146330
Works exactly how I want it to.
0
 
LVL 7

Expert Comment

by:Bruce Cadiz
ID: 34146646
StampIT,

Thanks. I believe the suggestions by gbanik regarding the XML parser is something you should look at. While as he stated it may seem complicated, if you were to eventually incorporate it, you would have more functionality / flexibility in the long run, especially if your XML data structures change in the future.

Bruce
0
 

Author Comment

by:StampIT
ID: 34146807
Bruce,
      Thanks. I will keep that in mind.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

873 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