Results 1 to 10 of 25

Thread: Need help to convert Excel data to XML

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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]

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
  •