Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Need help to convert Excel data to XML

  1. #1
    Junior Member
    Join Date
    Feb 2021
    Posts
    12
    Rep Power
    0

    Need help to convert Excel data to XML

    Hi,

    I'm trying to convert Excel data to XML but getting this error message - "Cannot save or export XML data. The XML maps in the workbook are not exportable."
    Please help to fix this, enclosing the error screenshot, Excel file and XML mapping file (uploaded as .txt file as I was unable to upload .xml file, please save as .xml). Thanks.








    Hello uakash7
    Welcome to ExcelFox

    Please can you try to upload larger images, minimum 50KB, - your ExportError.jpg is 20.4KB , - this is small in forum upload and is difficult to see.

    Thanks,
    Alan

    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://eileenslounge.com/viewtopic.php?p=244184#p244184
    https://eileenslounge.com/viewtopic.php?p=246586#p246586
    https://eileenslounge.com/viewtopic.php?p=246112#p246112
    https://eileenslounge.com/viewtopic.php?p=246112#p246112
    https://eileenslounge.com/viewtopic.php?p=245761#p245761
    https://eileenslounge.com/viewtopic.php?p=245722#p245722
    https://eileenslounge.com/viewtopic.php?p=245616#p245616
    https://eileenslounge.com/viewtopic.php?p=247043#p247043
    https://www.excelfox.com/forum/showthread.php/2307-VBA-Range-Sort-with-arrays-Alternative-for-simple-use
    https://eileenslounge.com/viewtopic.php?p=245238#p245238
    https://eileenslounge.com/viewtopic.php?p=245131#p245131
    https://eileenslounge.com/viewtopic.php?f=18&t=31638
    https://eileenslounge.com/viewtopic.php?p=244579#p244579
    https://eileenslounge.com/viewtopic.php?p=244648#p244648
    https://eileenslounge.com/viewtopic.php?p=244647#p244647
    https://eileenslounge.com/viewtopic.php?p=244577#p244577
    https://eileenslounge.com/viewtopic.php?p=245201#p245201
    https://eileenslounge.com/viewtopic.php?p=243975#p243975
    https://eileenslounge.com/viewtopic.php?p=243884#p243884
    https://eileenslounge.com/viewtopic.php?p=242439#p242439
    https://eileenslounge.com/viewtopic.php?p=243595#p243595
    https://eileenslounge.com/viewtopic.php?p=243589#p243589
    https://eileenslounge.com/viewtopic.php?p=243589#p243589
    https://eileenslounge.com/viewtopic.php?p=243002#p243002
    https://www.eileenslounge.com/viewtopic.php?p=242761#p242761
    https://eileenslounge.com/viewtopic.php?p=242459#p242459
    https://eileenslounge.com/viewtopic.php?p=242054#p242054
    https://eileenslounge.com/viewtopic.php?p=241404#p241404
    https://eileenslounge.com/viewtopic.php?p=229145#p229145
    https://eileenslounge.com/viewtopic.php?p=228710#p228710
    https://eileenslounge.com/viewtopic.php?p=226938#p226938
    https://eileenslounge.com/viewtopic.php?f=18&t=28885
    https://eileenslounge.com/viewtopic.php?p=222689#p222689
    https://eileenslounge.com/viewtopic.php?p=221622#p221622
    https://eileenslounge.com/viewtopic.php?f=27&t=22512
    https://eileenslounge.com/viewtopic.php?f=26&t=26183
    https://eileenslounge.com/viewtopic.php?f=26&t=26030
    https://eileenslounge.com/viewtopic.php?p=202322#p202322
    https://www.excelforum.com/word-formatting-and-general/1174522-finding-a-particular-word-phrase-in-word.html#post4604396
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by DocAElstein; 04-16-2024 at 06:41 PM.

  2. #2
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7

    Cool

    you can try with
    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <DataImport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    	<EntityID>EntityID</EntityID>
    	<data>
    		<date>
    			<day>day</day>
    			<month>month</month>
    			<year>year</year>
    		</date>
    		<recID>recID</recID>
    		<time>time</time>
    		<itemSold>ItemSold</itemSold>
    		<Price>Price</Price>
    	</data>
    </DataImport>
    as XML schema (not XSD!)
    but probably you'll see Denormalized Data error
    so I suggest
    W3C link
    and
    Normalizing XML link
    Last edited by sandy666; 02-11-2021 at 03:55 PM.
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  3. #3
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7

    Cool

    or try this Excel to XML

    InveralData.xlsx.xml.txt
    remove .txt and stay with .xml
    and after mapping
    test.xml.txt
    Last edited by sandy666; 02-11-2021 at 06:46 PM.
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  4. #4
    Junior Member
    Join Date
    Feb 2021
    Posts
    12
    Rep Power
    0

    Error Screenshot

    Thank you for looking into it, here is a bigger screenshot

    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://eileenslounge.com/viewtopic.php?p=244184#p244184
    https://eileenslounge.com/viewtopic.php?p=246586#p246586
    https://eileenslounge.com/viewtopic.php?p=246112#p246112
    https://eileenslounge.com/viewtopic.php?p=246112#p246112
    https://eileenslounge.com/viewtopic.php?p=245761#p245761
    https://eileenslounge.com/viewtopic.php?p=245722#p245722
    https://eileenslounge.com/viewtopic.php?p=245616#p245616
    https://eileenslounge.com/viewtopic.php?p=247043#p247043
    https://www.excelfox.com/forum/showthread.php/2307-VBA-Range-Sort-with-arrays-Alternative-for-simple-use
    https://eileenslounge.com/viewtopic.php?p=245238#p245238
    https://eileenslounge.com/viewtopic.php?p=245131#p245131
    https://eileenslounge.com/viewtopic.php?f=18&t=31638
    https://eileenslounge.com/viewtopic.php?p=244579#p244579
    https://eileenslounge.com/viewtopic.php?p=244648#p244648
    https://eileenslounge.com/viewtopic.php?p=244647#p244647
    https://eileenslounge.com/viewtopic.php?p=244577#p244577
    https://eileenslounge.com/viewtopic.php?p=245201#p245201
    https://eileenslounge.com/viewtopic.php?p=243975#p243975
    https://eileenslounge.com/viewtopic.php?p=243884#p243884
    https://eileenslounge.com/viewtopic.php?p=242439#p242439
    https://eileenslounge.com/viewtopic.php?p=243595#p243595
    https://eileenslounge.com/viewtopic.php?p=243589#p243589
    https://eileenslounge.com/viewtopic.php?p=243589#p243589
    https://eileenslounge.com/viewtopic.php?p=243002#p243002
    https://www.eileenslounge.com/viewtopic.php?p=242761#p242761
    https://eileenslounge.com/viewtopic.php?p=242459#p242459
    https://eileenslounge.com/viewtopic.php?p=242054#p242054
    https://eileenslounge.com/viewtopic.php?p=241404#p241404
    https://eileenslounge.com/viewtopic.php?p=229145#p229145
    https://eileenslounge.com/viewtopic.php?p=228710#p228710
    https://eileenslounge.com/viewtopic.php?p=226938#p226938
    https://eileenslounge.com/viewtopic.php?f=18&t=28885
    https://eileenslounge.com/viewtopic.php?p=222689#p222689
    https://eileenslounge.com/viewtopic.php?p=221622#p221622
    https://eileenslounge.com/viewtopic.php?f=27&t=22512
    https://eileenslounge.com/viewtopic.php?f=26&t=26183
    https://eileenslounge.com/viewtopic.php?f=26&t=26030
    https://eileenslounge.com/viewtopic.php?p=202322#p202322
    https://www.excelforum.com/word-formatting-and-general/1174522-finding-a-particular-word-phrase-in-word.html#post4604396
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Attached Files Attached Files
    Last edited by DocAElstein; 04-16-2024 at 06:37 PM.

  5. #5
    Junior Member
    Join Date
    Feb 2021
    Posts
    12
    Rep Power
    0
    Thank you Sandy, I tried both but it didn't give me the desired output. I'm looking for output like this -

    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <DataImport>
        <forecast>
    	<Entity>700</Entity>
    	<data>
    		<date>
    			<day>19</day>
    			<month>1</month>
    			<year>2021</year>
    		</date>
    		<period recID="7001">
    			<time>8:00</time>
    			<ItemSold>19</ItemSold>
    			<Price>219</Price>
    		</period>
    		<period recID="7001">
    			<time>8:30</time>
    			<ItemSold>21</ItemSold>
    			<Price>219</Price>
    		</period>
    	</data>
        </forecast>
        <forecast>
    	<Entity>701</Entity>
    	<data>
    		<date>
    			<day>20</day>
    			<month>1</month>
    			<year>2021</year>
    		</date>
    		<period recID="7002">
    			<time>8:00</time>
    			<ItemSold>20</ItemSold>
    			<Price>220</Price>
    		</period>
    		<period recID="7002">
    			<time>8:30</time>
    			<ItemSold>23</ItemSold>
    			<Price>220</Price>
    		</period>
    	</data>
        </forecast>
    </DataImport>
    However I'm getting output like this -

    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    	<records>
    		<record>
    			<EntityID>700</EntityID>
    			<ItemSold>23</ItemSold>
    			<Price>119</Price>
    			<day>19</day>
    			<month>2</month>
    			<recID>7001</recID>
    			<time>8:00</time>
    			<year>2021</year>
    		</record>
    		<record>
    			<EntityID>700</EntityID>
    			<ItemSold>25</ItemSold>
    			<Price>120</Price>
    			<day>19</day>
    			<month>2</month>
    			<recID>7001</recID>
    			<time>8:30</time>
    			<year>2021</year>
    		</record>
    		<record>
    			<EntityID>700</EntityID>
    			<ItemSold>24</ItemSold>
    			<Price>121</Price>
    			<day>19</day>
    			<month>2</month>
    			<recID>7001</recID>
    			<time>9:00</time>
    			<year>2021</year>
    		</record>
    and continues..

    so the entity IDs are not repeated and date is not repeated within entity tag if that helps.
    Last edited by DocAElstein; 02-14-2021 at 11:59 PM. Reason: # [Code] your code goes here .. [/code]

  6. #6
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7

    Cool

    here is a proper xml for mapping
    required.txt
    if you will see warning choose first
    existingformatting.png
    and here is exported xml from the table
    exported.txt

    Table
    EntityID day month year recID time ItemSold Price
    700
    19
    2
    2021
    7001
    8:00
    23
    119
    700
    19
    2
    2021
    7001
    8:30
    25
    120
    700
    19
    2
    2021
    7001
    9:00
    24
    121
    700
    19
    2
    2021
    7001
    9:30
    26
    110
    700
    19
    2
    2021
    7001
    10:00
    21
    119
    700
    19
    2
    2021
    7001
    10:30
    20
    119
    700
    19
    2
    2021
    7001
    11:00
    19
    120
    700
    19
    2
    2021
    7001
    11:30
    10
    119
    701
    19
    2
    2021
    7002
    8:00
    23
    121
    701
    19
    2
    2021
    7002
    8:30
    23
    123
    701
    19
    2
    2021
    7002
    9:00
    22
    119
    701
    19
    2
    2021
    7002
    9:30
    23
    119
    701
    19
    2
    2021
    7002
    10:00
    25
    119
    701
    20
    2
    2021
    7002
    8:00
    23
    145
    701
    20
    2
    2021
    7002
    8:30
    27
    121
    701
    20
    2
    2021
    7002
    9:00
    23
    119
    702
    19
    2
    2021
    7003
    8:00
    25
    128
    702
    19
    2
    2021
    7003
    8:30
    23
    123
    702
    19
    2
    2021
    7003
    9:00
    23
    124
    702
    19
    2
    2021
    7003
    9:30
    23
    119
    702
    20
    2
    2021
    7003
    8:00
    24
    119
    702
    21
    2
    2021
    7003
    9:30
    25
    128
    702
    22
    2
    2021
    7003
    9:30
    26
    119
    702
    22
    2
    2021
    7003
    10:00
    21
    120
    Last edited by sandy666; 02-12-2021 at 09:29 AM.
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  7. #7
    Junior Member
    Join Date
    Feb 2021
    Posts
    12
    Rep Power
    0
    Hi Sandy,

    The exported xml file looks like -

    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <DataImport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    	<forecast>
    		<Entity>700</Entity>
    		<data>
    			<date>
    				<day>19</day>
    				<month>2</month>
    				<year>2021</year>
    			</date>
    			<period recID="7001">
    				<time>8:00</time>
    				<ItemSold>23</ItemSold>
    				<Price>119</Price>
    			</period>
    		</data>
    	</forecast>
    	<forecast>
    		<Entity>700</Entity>
    		<data>
    			<date>
    				<day>19</day>
    				<month>2</month>
    				<year>2021</year>
    			</date>
    			<period recID="7001">
    				<time>8:30</time>
    				<ItemSold>25</ItemSold>
    				<Price>120</Price>
    			</period>
    		</data>
    	</forecast>
    However, what I need is -

    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <DataImport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    	<forecast>
    		<Entity>700</Entity>
    		<data>
    			<date>
    				<day>19</day>
    				<month>2</month>
    				<year>2021</year>
    			</date>
    			<period recID="7001">
    				<time>8:00</time>
    				<ItemSold>23</ItemSold>
    				<Price>119</Price>
    			</period>
    			<period recID="7001">
    				<time>8:30</time>
    				<ItemSold>25</ItemSold>
    				<Price>120</Price>
    			</period>
    		</data>
    	</forecast>
    	<forecast>
    		<Entity>701</Entity>
    		<data>
    			<date>
    				<day>19</day>
    				<month>2</month>
    				<year>2021</year>
    			</date>
    			<period recID="7002">
    				<time>8:00</time>
    				<ItemSold>23</ItemSold>
    				<Price>121</Price>
    			</period>
    		</data>
    	</forecast>
    </DataImport>
    Only one entry for each unique entity ID and one date entry for each unique date within each entity tag.
    Adding another sample file with few examples, hope it helps.
    Is there a way we can do this via VBA if not possible by just using XML mapping?
    Attached Files Attached Files
    Last edited by DocAElstein; 02-14-2021 at 11:59 PM. Reason: # [Code] your code goes here .. [/code]

  8. #8
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7
    I hate vba so I can't help
    Have a nice day
    Last edited by sandy666; 02-15-2021 at 04:35 PM.
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  9. #9
    Junior Member
    Join Date
    Feb 2021
    Posts
    12
    Rep Power
    0
    Hey Sandy,

    Is not possible via XML mapping? I'm not restricted to VBA, is there a way to get this done?
    Last edited by uakash7; 02-15-2021 at 12:35 PM.

  10. #10
    Junior Member
    Join Date
    Feb 2021
    Posts
    12
    Rep Power
    0
    Hi Alan,

    Did you get a chance to look into it? I had shared bigger image as you mentioned.

Similar Threads

  1. Replies: 6
    Last Post: 09-24-2020, 10:36 AM
  2. XML Mapping in Excel Sheet
    By Ranjithkumar in forum Excel Help
    Replies: 1
    Last Post: 01-28-2014, 09:14 AM
  3. Xml Mapping in Excel Macro
    By dhivya.enjoy in forum Excel Help
    Replies: 1
    Last Post: 10-18-2013, 04:11 PM
  4. Convert selected file to XML and save.
    By dhivya.enjoy in forum Excel Help
    Replies: 7
    Last Post: 10-09-2013, 01:32 PM
  5. Replies: 0
    Last Post: 08-23-2012, 08:00 AM

Posting Permissions

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