Tizza Posted August 30, 2007 Share Posted August 30, 2007 Hi All I am writing a script to automate a reporting process. One of my steps (the last step i need to figure out) is openening an Excel document through the script. When i manually open it and i see it on the screen, it works fine - that is... it does the data connects and runs the macro's. I am using the following code: <?PHP $excel = new COM("excel.application"); $excel->Visible = true; //Open workbook $wkb = $excel->Workbooks->Open('C:\Inetpub\wwwroot\test\CS.xls'); //Save the file $wkb->SaveAs("C:\Inetpub\wwwroot\test\\$case.xls"); //Quit MS Excel $wkb->Close(false); $excel->Workbooks->Close(); $excel->Quit(); unset($sheet1); unset($sheet2); unset($excel); ?> I see the process EXCEL run, then close but the file that is created does not include the data connects or macros. Therefore it is just a blank file. I have tried using an exec statement too: exec("excel C:\Inetpub\wwwroot\\test\cs.xls"); but it doesnt execute. Is there anything that can be done to make it so Excel will physically open on the server? Or even better.... Excel will open and refresh its data? Please let me know!!! I have tried a lot of different methods and havnt come any closer to figuring this out Thx! ~T Link to comment https://forums.phpfreaks.com/topic/67304-how-to-open-an-excel-file-through-php/ Share on other sites More sharing options...
halstead Posted September 3, 2008 Share Posted September 3, 2008 Hello Tizza, Did you ever figure out how to do this? I too am having this issue. Halstead Link to comment https://forums.phpfreaks.com/topic/67304-how-to-open-an-excel-file-through-php/#findComment-632665 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.