Hello,
I have many Stata results (tables, matrices) and I want to export them into several preformatted EXCEL sheets in a single EXCEL file (one table/matrix per sheet). Therefore I've created a preformatted EXCEL sheet which should be the template for all other sheets. Unfortunately putexcel only allows me to write in an already existing EXCEL sheet/template (or it creates an empty sheet/file). Is there any way how I can "convince" Stata/putexcel to duplicate the template and write every table/matrix into a newly created preformatted EXCEL sheet? Maybe there is another command? Am I missing something?
Any assistance is appreciated. If any information is missing, please don't hesitate to contact me.
Best,
Sebastian
P.S.: Creating sheets one by one with clicking in EXCEL isn't a option, because I need hundreds of sheets.
P.P.S.: My existing code either allows me to (over)write the template or to export it to a new unformatted sheet. (Each matrix should be in a separate sheet which should be formatted like the template)
I have many Stata results (tables, matrices) and I want to export them into several preformatted EXCEL sheets in a single EXCEL file (one table/matrix per sheet). Therefore I've created a preformatted EXCEL sheet which should be the template for all other sheets. Unfortunately putexcel only allows me to write in an already existing EXCEL sheet/template (or it creates an empty sheet/file). Is there any way how I can "convince" Stata/putexcel to duplicate the template and write every table/matrix into a newly created preformatted EXCEL sheet? Maybe there is another command? Am I missing something?
Any assistance is appreciated. If any information is missing, please don't hesitate to contact me.
Best,
Sebastian
P.S.: Creating sheets one by one with clicking in EXCEL isn't a option, because I need hundreds of sheets.
P.P.S.: My existing code either allows me to (over)write the template or to export it to a new unformatted sheet. (Each matrix should be in a separate sheet which should be formatted like the template)
Code:
*Existing code forvalues x = 1/150 { putexcel G3=matrix(A`x') using "sales.xlsx", sheet("template") modify keepcellf } * Suggestion which doesn't work as needed forvalues x = 1/150 { putexcel G3=matrix(A`x') using "sales.xlsx", sheet("sales_Area`x'") modify keepcellf }
Comment