简体   繁体   English

将数据导出到Excel工作表

[英]export data to excel sheet

I have used some code in which i am exporting database table data to excel sheet using php. 我使用了一些代码,其中我使用php将数据库表数据导出到excel表。 But whenever it downloads the file first it opens with a error that it is not in supported format. 但是,每当它首先下载文件时,它都会打开,并显示错误的格式,即格式不受支持。 By clicking yes it opens and show my complete data but in the last of the sheet the footer is also displayed. 通过单击“是”,它会打开并显示我的完整数据,但在工作表的最后,也会显示页脚。

Code

 <?php

 if(isset($_POST['download'])){

 // The function header by sending raw excel
 header("Content-type: application/vnd-ms-excel");

 // Defines the name of the export file "codelution-export.xls"
 header("Content-Disposition: attachment; filename=Subscribers.xls");
 ob_clean();
 // Add data table
 include 'data.php';
 }

error 错误

在此处输入图片说明

in sheet error 表中错误

在此处输入图片说明

i want to remove the footer from the excel sheet and the error in opening the file. 我想从Excel工作表中删除页脚,并打开文件时出错。

You can use library for exporting database value to excel 您可以使用库将数据库值导出到excel
https://phpexcel.codeplex.com/ https://phpexcel.codeplex.com/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM