+ Reply to Thread
Results 1 to 8 of 8

Importing XML, one row of data no column headers shown

Hybrid View

  1. #1
    Registered User
    Join Date
    02-11-2014
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Importing XML, one row of data no column headers shown

    This post was started a bit ago but it was never resolved. I am now having this same issue as was wondering if anyone out there can help me come to a solution. I'm using Excel 2010

    This came from the post:
    When I import XML with multiple rows of data, I get lovely column headers generated for me automatically. When I import XML with only one, single row of data, there are no column headers generated. Since the application I am working with generates the XML dynamically, I would like to know if there is an easy solution for this.

    Examples:

    This generates column headers when imported into Excel:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <data>
    <row>
    <name>Chris</name>
    <color>green</color>
    </row>
    <row>
    <name>Pat</name>
    <color>orange</color>
    </row>
    </data>

    This does NOT generate column headers when imported into Excel:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <data>
    <row>
    <name>Chris</name>
    <color>green</color>
    </row>
    </data>

    http://www.excelforum.com/excel-gene...ers-shown.html

  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,794

    Re: Importing XML, one row of data no column headers shown

    Could you upload a sample file perhaps? If you do so be aware of the fact that the forum "Attachment Manager" will not accept a file with an xml exstencion you need to rename it to xls in order to upload it.

    Alf

  3. #3
    Registered User
    Join Date
    02-11-2014
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Importing XML, one row of data no column headers shown

    I've attached an example file which only contains 1 row. But when I imported to excel 2010 the headers are missing.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    02-11-2014
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Importing XML, one row of data no column headers shown

    Any help on this?

  5. #5
    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,794

    Re: Importing XML, one row of data no column headers shown

    Sorry I can’t find any solution to you problem. I’ve had an OP who needed a macro to import xml files and I’ve been studying his file (imports to columns) to see if I could find how it differed from your file but could not see anything that explains you problem.

    If you like to have a go at it the thread is here

    http://www.excelforum.com/excel-prog...ml#post3575403

    and you will find his file in post #10. The file has an xls extension so you need to rename it to xml.

    Alf

  6. #6
    Registered User
    Join Date
    02-11-2014
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Importing XML, one row of data no column headers shown

    Sound good. I'll check it out. Thanks

  7. #7
    Registered User
    Join Date
    04-24-2017
    Location
    Hutchinson, MN
    MS-Off Ver
    Office 365
    Posts
    1

    Re: Importing XML, one row of data no column headers shown

    I do not know the real cause for the issue but I was able to create a "work around". I suspect the import method recognizes the single layer XML as a "record" and the multi-layer as a "table". I am using Office 365.

    What I did:
    1) Edited the single layer XML and created a duplicate item by copy-paste of the first item in the XML. Saved XML file as a different name: i.e: basemap.xml
    2) In Excel: Data --> From Other Sources --> From XML Data Import. Navigate to basemap.xml. Insert as XML table in existing worksheet.
    3) A table with headers should be produced from the XML file. The table will have 2 duplicate entries based on the duplicated item copied in step 1.

    If you want to import multiple XML files of the same format into the same table:
    4) Select first cell in table. Right click. Select XML --> Import
    5) Navigate to folder of XML files.
    6) Highlight all XML files that you would like to import. (The original XML that created the table does not need to be selected.)
    7) Select "Open"

    Hope this is useful.

    Tim
    Last edited by TimMcD; 09-11-2019 at 05:38 PM.

  8. #8
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2506
    Posts
    13,792

    Re: Importing XML, one row of data no column headers shown

    @ i2rule

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Dave

+ 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. Importing XML, one row of data no column headers shown
    By DBecker in forum Excel General
    Replies: 3
    Last Post: 07-17-2013, 02:19 AM
  2. Column Headers/Names that stay set when Importing Data
    By hardhitter06 in forum Excel General
    Replies: 5
    Last Post: 07-07-2009, 03:48 PM
  3. Column of Text Shown = Total Times Shown?
    By philcassell in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-19-2006, 02:25 AM

Tags for this Thread

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