/** proc: makecolumnheaders :author: Alan G Isaac :license: MIT **/ proc(1) = makecolumnheaders(morecolheaders); local columnheaders; columnheaders = {}; for i(1,26,1); columnheaders = columnheaders $|chrs(64+i); endfor; for i(1,morecolheaders,1); columnheaders = columnheaders $| (columnheaders[i] $+ columnheaders[1:26]); endfor; retp(columnheaders); endp; // csExcelWritetoCol // author: Christie Smith 23 August 2005 // (lightly modified by Alan G Isaac on 2006-06-10) // // PURPOSE: Specify a spreadsheet and a column number to write a data series y to. // // INPUTS: y: data series [capT by k] // filenamestring: String: the filename you want to write to // RownumberBegin: Starting row that receives data // ColnumberBegin: Starting column that receives the data // sheetnum: 'Sheet number' to write to (sheets are numbered from left to right) // // OUTPUT: xlsret: Boolean indicating if spreadsheet write was successful // // This procedure is distributed under the GNU General Public License, version 2, June 1991. // See http://www.gnu.org/licenses/gpl.txt. // // ************************************************************************ proc(1)=csExcelWritetoCol(y, filenamestring, rownumberBegin, ColnumberBegin, sheetnum); local alphabet, capT, k, numba, numbawidth, rownumBegStrWidth, rownumBegStr, numbastring, xlsret; // Write the appropriate forecasts to an Excel spreadsheet automatically // Corresponds to the letters associated with Excel columns capT=ROWS(y); k=cols(y); if rowNumberBegin<10; rownumBegStrWidth=1; elseif ((9=100)and (rowNumberBegin>1000); rownumBegStrWidth=3; else; errorlog "Update csWritetoExcelCol to take bigger rowNumberBegins"; endif; rownumBegStr=ftos(rowNumberBegin,"%*.*lf",rowNumBegStrWidth,0); numba=ROWS(y)+rowNumberBegin-1; if numba<10; numbawidth=1; elseif ((9=100)and (numba>1000); numbawidth=3; elseif (numba>=1000)and (numba>10000); numbawidth=4; else; errorlog "Update csWritetoExcelCol to take bigger numbawidths"; endif; numbastring=ftos(numba,"%*.*lf",numbawidth,0); alphabet = makecolumnheaders(1); xlsret = SpreadsheetWrite(y, filenamestring, alphabet[ColnumberBegin]$+rownumBegStr $+ ":" $+ alphabet[ColnumberBegin+COLS(y)-1] $+ numbastring, sheetnum); retp(xlsret); endp;