Uploading data to Excel in php

Hello dear programmers. I am faced with the task of automating reporting in Excel. At first glance, there are about 200 reports.

I looked on the Internet for classes for unloading, but using them is very long and “stressful” to do. Is there any universal system, maybe a class that supports the similarity of templates?

I would also like to have no technology, because they don’t give a Windows server at work.

I look forward to your advice. I will consider any option.


Answer 1, authority 100%

Look here http://exls.ru

Short:

  • supports templates;
  • uploads to .xls, .xls.gz, .zip formats;
  • it is possible to expand formats;
  • no php programming needed;
  • supports input parameters;
  • supports modules (for example: unloading mail headers in excel);
  • will work on any hosting.

I took part in writing this system.


Answer 2, authority 100%

There is a library PhpExcel, which is pretty good, I used it myself for this task. Lots of features (styles, formulas, validation, etc.). Object-oriented. The only negative is that it is very power hungry for documents with a lot of styles. But the problem is solved by templates (you fill in Excel an empty document with styles, formulas, etc.) and php only fills with data (for this, in addition to the writer, there is a reader).
There is an alternative Spreadsheet Excel Writer, which is completely binary, so it’s not as memory hungry. But accordingly, the possibilities are cut. In addition, it is difficult to work with Office 2007 and beyond. By the way, PhpExcel writer5 (for generating xls (not xlsx) documents, based on Spreadsheet Writer.

So I recommend using the first lib and having colorful reports than dealing with the second one.


Answer 3, authority 50%

I stupidly do this:

<HTML xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<HEAD>
  <meta http-equiv=Content-Type content="text/html; charset=windows-1251">
  <STYLE>
table {
  mso-displayed-decimal-separator:"\,";
  mso-displayed-thousand-separator:" ";
}
td {
  text-decoration: none;
  font-family: Tahoma, Arial;
  border:none;
  white-space:nowrap;
}
.item {
  mso-number-format:Fixed;
  border:0.5pt solid silver;
  white-space: normal;
  font-size:9.0pt;
  padding: 10pt
}
.header {
  font-weight: bold;
  font-size:10.0pt;
  background:gray;
  color:white;
  whitespace:normal;
}
.rootCategory {
  font-weight: bold;
  font-size:11.0pt;
  border: .5pt solid black;
  background:gray;
  color:white;
}
.category {
  font-weight: bold;
  font-size:10.0pt;
  border:.5pt solid windowtext;
  background: silver;
  color:white;
}
b { font-weight: normal } </STYLE>
<!--[if gte mso 9]><xml>
 <x:ExcelWorkbook>
 <x:ExcelWorksheets>
  <x:ExcelWorksheet>
  <x:Name>price1</x:Name>
  <x:WorksheetOptions>
   <x:NoSummaryRowsBelowDetail/>
   <x:Print>
   <x:ValidPrinterInfo/>
   <x:PaperSizeIndex>9</x:PaperSizeIndex>
   <x:VerticalResolution>0</x:VerticalResolution>
   </x:Print>
   <x:Zoom>90</x:Zoom>
   <x:Selected/>
   <x:FreezePanes/>
   <x:FrozenNoSplit/>
   <x:SplitHorizontal>2</x:SplitHorizontal>
   <x:TopRowBottomPane>2</x:TopRowBottomPane>
   <x:SplitVertical>100</x:SplitVertical>
   <x:LeftColumnRightPane>4</x:LeftColumnRightPane>
   <x:ActivePane>0</x:ActivePane>
   <x:panes>
   <x:pane>
    <x:Number>3</x:Number>
   </x:pane>
   <x:pane>