Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

i would like to insert a data xml into a cell of excel

Status
Not open for further replies.

melina

Programmer
Apr 19, 2001
1
LU
i would like to know how i can insert an xml information into a Excel cell.i known that i must create a csv file but i can't place information at the right place (row x and column y) a sample would be welcome
 
Hi.

Here is an example to use Excel App through JavaScript.
If you want, I explain what does it do.

...
<xml id=&quot;XmlDoc&quot; src=&quot;scaWC.xml&quot;></xml>
..
<Script Language=&quot;JavaScript&quot;>
function expXML()
{
var xlObj=new ActiveXObject(&quot;Excel.Application&quot;);
xlObj.Visible=true;

var eWB=xlObj.Workbooks.Open(&quot; var eSheet=eWB.ActiveSheet;

var xmlElem=XmlDoc.documentElement;
var iCount=xmlElem.childNodes.length;
var nCount=xmlElem.childNodes.item(1).childNodes.length;
var xValue=&quot;&quot;;
for(i=1;i<iCount;i++){
for(n=1;n<nCount-1;n++){
xValue=xmlElem.childNodes.item(i).childNodes.item(n).text;
eSheet.Cells(4+i,1+n).Value=xValue;
}

}
alert(&quot;Export completed. Select SaveAs to Save the Excel Sheet.&quot;);
}
</Script>
...

regards, Kirilla
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top