Pathways to an Excel file - PHP
Hello,
I try to browse a php file to insert a mysql database. (to make dynamic pages from the database after). And I started by searching on the net, and the only book I found that can generate Excel files with php, so in that sense too
I wonder if this is possible (by browsing the file directly xls ca can not walk because of the binary)
And if not, there is the option of using Microsoft COM objects (my server is on windows) to interact with Excel. But I've never used COM, and I am not sure how it works.
So I want to summarize retrieve data from an Excel file. Can you help please.
Re: Pathways to an Excel file - PHP
In Excel: Save As \ File type: CSV
Look what it gives you, you should have less difficulty
Re: Pathways to an Excel file - PHP
Yeah, I know this solution is obvious that it would be more practical to go through.
But I'd like to do it without the user must save the file every time. (I'm working for an intranet, there's a lot of files to manage and people are disabled :-()
That's why I was looking for a PHP ONLY.
But thank you
Re: Pathways to an Excel file - PHP
Arf, PHP ONLY, I do not see how in this case ...
As against a macro in Excel, which saves the file in the right format, possibly with the addition of a button in the menu bar to call this macro, it is very doable ...
A large button which is 10 cm by 5 is not User Friendly.
Re: Pathways to an Excel file - PHP
Quote:
C reading a bit like writing for only open at the beginning ...
But try to access data are the same.
$ excel = new COM ( "Excel.Application"); / / Open connection to Excel
$ workbook = $ excel-> Workbooks-> Open ($ filename);
/ / Name of the file to open: absolute
/ / I selected to read the paper (the numbering starts leaves 1
$ sheet = $ workbook-> Worsheets ($ no_feuille);
/ / To read a cell eg A1 ...
/ / I select:
$ cell = $ sheet-> Range ( "A1");
/ / I do its contents:
echo $ cell-> value;
/ / I close the document
/ / If Excel is the head because it did not saved
/ / $ File-> save ();
$ workbook-> close ();
/ / I close excel
$ excel-> Workbooks-> close ();
$ excel-> Quit ();
/ / And we do unset all variables that controls
otherwise there is good tutorial on W3Schools.com