Export excel data to xml format

uakash7

New Member
Joined
Apr 1, 2019
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi, I want to covert data in excel file to xml format (Developer - Export option) ExportError.pngbut getting this error message - "Cannot save or export XML data. The XML maps in this workbook are not exportable." Can you please help me to convert this excel data to xml format using Excel tool or VBA. Enclosing the error screenshot and xml mapping below -

<?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>
<period recID="7001">
<time>9:00</time>
<ItemSold>23</ItemSold>
<Price>219</Price>
</period>
<period recID="7001">
<time>9:30</time>
<ItemSold>26</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>
<period recID="7002">
<time>9:00</time>
<ItemSold>25</ItemSold>
<Price>220</Price>
</period>
<period recID="7002">
<time>9:30</time>
<ItemSold>28</ItemSold>
<Price>220</Price>
</period>
<period recID="7002">
<time>13:00</time>
<ItemSold>31</ItemSold>
<Price>220</Price>
</period>
</data>
</forecast>
</DataImport>
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
I believe it's because you are using an XML file for the map that repeats the <period> element. Refer Issue: Verifying an XML map for export for what's not allowed.

Excel XML mapping/exporting is not that capable except for quite 'flat' output. So it's good for simple cases, but if you really want to have <period> repeated (which is valid XML, of course), you will probably need to process the Excel-exported XML to transform it or otherwise write bespoke VBA to do it.

Try this instead as the map if you want to have a map that does work (I tested it and it's good):

<?xml version="1.0" encoding="UTF-8"?>
<DataImport>
<forecast>
<Entity></Entity>
<data>
<date>
<day></day>
<month></month>
<year></year>
</date>
<period recID="">
<time></time>
<ItemSold></ItemSold>
<Price></Price>
</period>
</data>
</forecast>
<forecast>
<Entity></Entity>
<data>
<date>
<day></day>
<month></month>
<year></year>
</date>
<period recID="">
<time></time>
<ItemSold></ItemSold>
<Price></Price>
</period>
</data>
</forecast>
</DataImport>
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top