sandhya Posted May 18, 2010 Share Posted May 18, 2010 hi all, I have a form with emailid textfield. I have to save that email id in an excel file every time the email id entered.I'm able to do it in text file. but i'm confused with excel file. any body can provide code for this? I"ll be so thankful.Thanks in advance. Quote Link to comment Share on other sites More sharing options...
siric Posted May 18, 2010 Share Posted May 18, 2010 AFAIK, You would have to store it in a csv and then import it into Excel. Quote Link to comment Share on other sites More sharing options...
Mchl Posted May 18, 2010 Share Posted May 18, 2010 If on Windows you can use COM object to communicate to Excel. On all platforms you can use libraries like phpexcel: http://phpexcel.codeplex.com/ Quote Link to comment Share on other sites More sharing options...
sandhya Posted May 18, 2010 Author Share Posted May 18, 2010 Hi Siric & Mchl, Thanks for your reply.and i have a doubt.so, Is it not possible to add email id directly to excel file every time the form submitted? Actually I"ll create an excel file first. and later that file should be updated with the email id in the next row each time the form submitted. Quote Link to comment Share on other sites More sharing options...
Mchl Posted May 18, 2010 Share Posted May 18, 2010 It is possible. For example to insert data into a cell using COM object you would do this: $excel = new COM("Excel.sheet"); $workbook = $excel->application->Workbooks->Open('filename.xls'); $worksheet = $workbook->Worksheets('sheetName'); $worksheet->Cells($row,$column)->value = 'put your value here'; $excel->application->ActiveWorkbook->Close(false); You need to do this on Windows and have Excel installed. It's also terribly slow (as it basicaly starts Excel in background). For small Excel files using a library like phpExcel is probably a better choice. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.