<?xml version="1.0"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"> <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"> <Version>10.2625</Version> </DocumentProperties> <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"> </OfficeDocumentSettings> <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> <WindowHeight>9000</WindowHeight> <WindowWidth>13860</WindowWidth> <WindowTopX>240</WindowTopX> <WindowTopY>75</WindowTopY> <ProtectStructure>False</ProtectStructure> <ProtectWindows>False</ProtectWindows> </ExcelWorkbook> <Styles> <Style ss:ID="Default" ss:Name="Normal"> <Font ss:FontName="Arial1" ss:Size="10"/> </Style> </Styles> <Worksheet ss:Name="Sheet1"> </Worksheet> </Workbook>I'd then read this in line by line til I go to the start of the worksheet and add my content.
<Table ss:DefaultColumnWidth="50" ss:DefaultRowHeight="15.75"> <Column ss:Width="100"/> <Column ss:Width="100"/> <Row ss:Height="15.75"> <Cell ss:StyleID="Default"><Data ss:Type="String">This is my test sheet</Data></Cell> <Cell ss:StyleID="Default"><Data ss:Type="Number">1234567890</Data></Cell> </Row> </Table>save that textfile as yournewxslfile.xsl and you should have a working excel file without touching automation.
tstring1 = fgets(templatefile,1000) do while alltrim(tstring1) != "</Table>" fputs(newxlsfile,tstring1) && Write string into file tstring1 = fgets(templatefile,1000) enddo tstring = '<Row ss:Height="15.75">' fputs(newxlsfile,tstring) && Write string into file tstring = '<Cell ss:StyleID="Default"><Data ss:Type="String">' + alltrim(mystring_variable) + '</Data></Cell>' fputs(newxlsfile,tstring) && Write string into file tstring = '<Cell ss:StyleID="Default"><Data ss:Type="Number">' + alltrim(mynumber_variable) + '</Data></Cell>' tstring = '</Row>' fputs(newxlsfile,tstring) && Write string into file tstring = '</Table>' fputs(newxlsfile,tstring) && Write string into file tstring = ' </Worksheet>' fputs(newxlsfile,tstring) && Write string into file tstring = '</Workbook>' fputs(newxlsfile,tstring) && Write string into filepretty much everything is available right down to conditional formatting and the like.