I currently have the following codes:

output = Grid [{{"fiscalyear", "companyname", "keyword1frequency", 
"trapwordfrequency", "keyword-trapword"}, {fiscalyear, 
companyname, keyword1frequency, trapwordfrequency, secondDV}}]

TextString[fiscalyear], "_", TextString[companyname], 
".csv"], output]

which gets me an excel output with a line that has fiscal year, companyname and other variables. However, this output has only one line but i want to run my main code more than 100 times such that i could append the next company's information right below (next row) each company. Could anyone help please? The above code would generate 100 excel files if i were to run the code 100 times but i would like one file with 100 rows instead!


1 Answer 1


Assume that you have some functions that compute fiscal year, company name, keyword etc. Then you would could use code like this:

res= Table[compute[i], {i,1,100}]; 
output= Prepend[res, "Fiscal year", "Company name", ".."]; 
Export["output.xlsx", output]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.