A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

converting an .xlsm file to .xml?



 
 
Thread Tools Display Modes
  #1  
Old March 13th, 2010, 12:11 AM posted to microsoft.public.excel.worksheet.functions
Janis
external usenet poster
 
Posts: 267
Default converting an .xlsm file to .xml?

how do you save an .xlsm file as .xml?
the excel files are simple files with cells with no calculations.
the records are county property records with some numbers and text.
I thought you could save as .xml previously but I have Excel 2007.
I turned on the Developer tab and export is greyed out?
thanks,

  #2  
Old March 14th, 2010, 08:53 PM posted to microsoft.public.excel.worksheet.functions
Chip Pearson
external usenet poster
 
Posts: 1,343
Default converting an .xlsm file to .xml?

You first need to create an XSD schema using your favorite XML editor
(I use XML Spy, which is fantastic), or a text editor like Notepad.
For example, given data on a worksheet like


Groups Number Tens Hundreds
One 1 10 100
Two 2 20 200
Three 3 30 300
Four 4 40 400

I created a schema named TestSchema.xsd as shown below:

?xml version="1.0" encoding="UTF-8"?
xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified"
targetNamespace="http://www.cpearson.com/test"
xmlns:test="http://www.cpearson.com/test"
xs:element name="Groups"
xs:complexType
xs:sequence
xs:element name="Group" minOccurs="1"
maxOccurs="unbounded"
xs:complexType
xs:sequence
xs:element name="Title"/xs:element
xs:element name="Number"/xs:element
xs:element name="Tens"/xs:element
xs:element name="Hundreds"/xs:element
/xs:sequence
/xs:complexTyp
/xs:element
/xs:sequence
/xs:complexType
/xs:element
/xs:schema


Then, on the Developer tab in Excel, click the Source button to open
the XML Source task pane. At the bottom of that, click the XML Maps
button and in that dialog, click Add to open your schema xsd file and
click OK. Now, click the top-most element in the XML tree (labelled
Groups in this example), and drag that item to the upper left corner
of the data on the worksheet ("Groups" in the worksheet example
above). Excel will format the table with lots of pretty colors that
you can get rid of by unchecking the "banded rows" checkbox on the
Table Style Options panel. Now, go back to the Developer tab,click
Export, and specify the name of the xml file to which you want to save
the data.

As often as not, I end up just using VBA input/output procedures to
write the raw XML directly to a file rather than jumping through
Excel's hoops.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com




On Fri, 12 Mar 2010 16:11:01 -0800, Janis
wrote:

how do you save an .xlsm file as .xml?
the excel files are simple files with cells with no calculations.
the records are county property records with some numbers and text.
I thought you could save as .xml previously but I have Excel 2007.
I turned on the Developer tab and export is greyed out?
thanks,

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:31 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.