+ Reply to Thread
Results 1 to 7 of 7

XML Import help

  1. #1
    Registered User
    Join Date
    06-06-2012
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    13

    XML Import help

    Using Excel 2007

    I am having problems with reformatting imported XML data.

    First step is to retrieve an XML data file from a web location. The data is loaded into a separate worksheet. Unfortunately some of the data fields are not in a usable format. To correct the data for my use, I have a separate worksheet where I copy, and if necessary, manipulate some of the data fields in each input row. Each row of this new sheet reads a corresponding row in the XML table.This new sheet is then used to create pivot tables.

    The problem I have is that the XML data is dynamic, often changing every time I refresh the input. What this also does is change the XML table range, most importantly the number of rows brought in. When this happens, it causes the formulas in the second worksheet to get scrambled,. By this I mean that one row will have all of it's formulas pointing to a specific row in the XML table. The next row should be offset to the next row, but somehow it gets out of sequence, often jumping any number of rows.depending on how many input rows the XML feed has each time.

    Small example:

    ........Col A....................Col B........................Col c
    =XMLTable!A3.......= XMLTable!B3........=XMLTable!C3
    =XMLTable!A4.......= XMLTable!B4........=XMLTable!C4
    =XMLTable!A10.... = XMLTable!B10......=XMLTable!C10 Here's where the jump takes place.

    I can't come up with a way to get around this issue. Any help appreciated.
    Last edited by mnowinski; 02-27-2014 at 09:08 PM.

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: XML Import help

    Perhaps you could upload an XML sample file?

    Be aware the Forum uploading setting will not accept XML files so changing file extension to XLS will make it possible to upload. You also need to make forum members who may wish to help you aware this fact so they can rename it back to XLM.

    Alf

  3. #3
    Registered User
    Join Date
    06-06-2012
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: XML Import help

    Thanks for the reply Alf. Unfortunately the data is sensitive and I'm not allowed to release it. If there is another way without giving out the data, I'd be glad to do it.

    I realize trying to define a situation like this is a bit confusing. If anyone needs further info, I can try to reword it.

    Mike

  4. #4
    Forum Contributor
    Join Date
    04-24-2007
    Location
    NYC
    MS-Off Ver
    2k3/2k7/2010
    Posts
    270

    Re: XML Import help

    you can open the xml file in notepad or word, and edit the sensitive data. Then upload the xml. No one will be able to help you unless they see the xml structure.

  5. #5
    Registered User
    Join Date
    06-06-2012
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: XML Import help

    Quote Originally Posted by slx View Post
    you can open the xml file in notepad or word, and edit the sensitive data. Then upload the xml. No one will be able to help you unless they see the xml structure.
    I've managed to get some data from the file and hope this will suffice. It includes the XML header and one line of data. The actual file will have anywhere from 50-75 similar lines od data.

    <?xml version="1.0" encoding="UTF-8"?>

    -<AssignmentItems xmlns:schemaLocation="http://www.website.net/datafeed_assignments.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.website.net" total="87">


    -<Assignment>

    <Id>166757488</Id>

    <Status>Ready</Status>

    <Location>RJAH</Location>

    <From>RJAH</From>

    <Destination>RKNW</Destination>

    <Assignment>Restricted</Assignment>

    <Amount>5</Amount>

    <Units>Units</Units>

    <ExpireDateTime>2014-03-05 12:34:59</ExpireDateTime>

    <Locked>CG</Locked>

    <Comment>Some Comment</Comment>

    </Assignment>
    </AssignmentItems>

  6. #6
    Forum Contributor
    Join Date
    04-24-2007
    Location
    NYC
    MS-Off Ver
    2k3/2k7/2010
    Posts
    270

    Re: XML Import help

    the file starts and ends with assignmentitem? is the structure like this?
    <assignmentitems ..blah...blah...>
    <assignment>
    ...stuff...
    </assignment>
    <assignment>
    ...stuff...
    </assignment>
    <assignment>
    ...stuff...
    </assignment>
    </assignmentitems>

    The solution to this would be a macro that can parse the xml and will look for specific data pieces to pull, i.e. Units/Status/Location.

  7. #7
    Registered User
    Join Date
    06-06-2012
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: XML Import help

    Yes, that's correct. Each [Assignment]xxxx[/Assignment] set is a unique data row. The {/Assignmentitems] code says that there is no more input data.

    I don't have any problem with getting the XML data into columns on the sheet. The problem I have is I have to reformat and parse some of the data and I can't just add it on the end of the XML tables So, what I do is create a new sheet and copy/reformat/parse the individual data fields row by row from the XML table using "=" functions. Ex. =XML!E1 As the XML table is dynamic, there are sometimes more, or less rows when I refresh. When this happens, the copied data formulae somehow get out of sync with the XML table and I can't figure out why, or how to stop it.
    Last edited by mnowinski; 03-06-2014 at 10:17 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Power Pivot SQL Data Import - How to update import filter
    By minnesotaart in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 10-29-2013, 12:39 PM
  2. Import exvel spreadsheet using a saved import specification
    By dubbdan in forum Access Tables & Databases
    Replies: 1
    Last Post: 08-19-2013, 05:13 PM
  3. Implementing TextFile import Delimiter settings on TXT Import VBA Script
    By Canuckle777 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-19-2013, 02:06 PM
  4. Import Macro sometimes adding data to end of last import
    By himynameisiain in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-30-2013, 07:06 AM
  5. Import External Data doesn't import
    By JakeAy in forum Excel General
    Replies: 7
    Last Post: 01-26-2010, 03:58 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1