{"id":309957,"date":"2019-10-29T12:32:42","date_gmt":"2019-10-29T12:32:42","guid":{"rendered":"https:\/\/www.knowband.com\/blog\/?p=309957\/"},"modified":"2025-11-17T10:45:36","modified_gmt":"2025-11-17T10:45:36","slug":"export-php-data-xls-file","status":"publish","type":"post","link":"https:\/\/www.knowband.com\/blog\/tips\/export-php-data-xls-file\/","title":{"rendered":"Export PHP data to .xls file"},"content":{"rendered":"<p>Data\u00a0is any set of\u00a0characters that is translated for some purpose, like for analysis. It can be any character or value, including text and numbers, pictures, sound, or video. If data is not put into context then it does not do anything to a human being or machine.<\/p>\n<p>We generally export data from the websites to save it on the computer for offline used like to maintain list data and to analysis it. Excel is the best format to Export data in a file\u00a0because reading large files is much easier in Excel for the user. Also, you can use additional functions like selecting individual cells to import the data, convert dates and time automatically, filters, sorting, reading formulas and their results etc.<\/p>\n<div class=\"module_in_content_container\">\n<div class=\"module_content\">\n        <img loading=\"lazy\" decoding=\"async\" class=\"module_image\" src=\"https:\/\/cdn.knowband.com\/image\/cache\/data\/chatgpt-chatbot-module-2-740x740.webp\" alt=\"Integrate Your PrestaShop Store with AI Chat Support\" width=\"100\" height=\"100\" \/><\/p>\n<div class=\"module_content_part\">\n<h3 class=\"title\">Integrate Your PrestaShop Store with AI Chat Support<\/h3>\n<p class=\"module_content_text\">Boost engagement and conversions with instant AI replies, multilingual support, and real-time order updates.<\/p>\n<p>            <!-- Added keyword anchor for SEO --><\/p>\n<p style=\"margin: 0 0 10px 0;\">\n                <a href=\"https:\/\/www.knowband.com\/prestashop-chatbot-module\" \n                   target=\"_blank\" rel=\"noopener\"\n                   style=\"color:#000; text-decoration:underline;\"><br \/>\n                    PrestaShop AI ChatBot Module<br \/>\n                <\/a>\n            <\/p>\n<p>            <a class=\"link_2_to_module\" style=\"display: inline-block; color: #f36!important;\" \n                href=\"https:\/\/www.knowband.com\/prestashop-chatbot-module\" \n                target=\"_blank\" rel=\"noopener\"><br \/>\n                <span class=\"read-more\">SHOP NOW<\/span><br \/>\n            <\/a>\n        <\/div>\n<\/p><\/div>\n<\/div>\n<style>\n.module_in_content_container { display: flex; flex-direction: column; padding: 20px; border: 1px solid #ccc; font-size: 16px; line-height: 26px; box-shadow: 0 3px 0 #ebebeb; -webkit-box-shadow: 0 3px 0 #ebebeb; position: relative; margin-bottom: 1.5em; }\n.module_in_content_container>a { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }\n.module_content { display: flex; align-items: flex-start; }\n.module_content img { max-width: 100px; margin-right: 20px; }\n.module_content_part p.module_content_text { margin-bottom: 10px; margin-top: 0; font-size: 18px; color: #000; }\n.module_content h3 { font-size: 24px; font-weight: 700; line-height: 1.5em; padding-left: 0; padding-top: 0; margin: 0; }\n.read-more { font-size: 18px; font-weight: 700; line-height: 1.5em; position: relative; display: inline-block; text-transform: uppercase; color: #f36; }\n.read-more:after { position: absolute; content: ''; width: 1.5em; height: 1.5em; top: -1px; right: -1.5em; background: url(https:\/\/knowband.com\/mobile-app\/wp-content\/uploads\/images\/readmore-arrow.svg) no-repeat center \/ .75em; transition: all .2s; }\n.read-more:focus, .read-more:hover { text-decoration: none; cursor: pointer; }\n.read-more:hover:after { right: -2em; transition: all .2s; }\n@media (max-width: 600px) {\n    .module_content { flex-direction: column; align-items: center; text-align: center; }\n    .module_content img { margin: 0 auto 20px auto; max-width: 100%; }\n    .module_content .title { flex-basis: auto; margin-top: 20px; }\n    .module_content_part p.module_content_text { font-size: 16px; line-height: 24px; }\n    .read-more { font-size: 16px; }\n}\n<\/style>\n<p><a href=\"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/10\/Excel-Additional-Functions.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-823197 size-full\" src=\"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/10\/Excel-Additional-Functions.png\" alt=\"Additional excel functions by Knowband\" width=\"800\" height=\"793\" srcset=\"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/10\/Excel-Additional-Functions.png 800w, https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/10\/Excel-Additional-Functions-150x150.png 150w, https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/10\/Excel-Additional-Functions-300x297.png 300w, https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/10\/Excel-Additional-Functions-768x761.png 768w, https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/10\/Excel-Additional-Functions-60x60.png 60w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><br \/>\nIn this blog we will learn how to export PHP data to .xls file step by step. With the help of simple PHP script you can export data to Excel and download it in a .xls file.<\/p>\n<p><a href=\"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/10\/Step-by-step-guide-to-export-PHP-data-to-.xls-file.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-823183 size-full\" src=\"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/10\/Step-by-step-guide-to-export-PHP-data-to-.xls-file.png\" alt=\"Step by step guide by Knowband - to export PHP data to .xls file\" width=\"700\" height=\"480\" srcset=\"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/10\/Step-by-step-guide-to-export-PHP-data-to-.xls-file.png 700w, https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/10\/Step-by-step-guide-to-export-PHP-data-to-.xls-file-300x206.png 300w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<h2>STEP 1: Create an Array to store the data<\/h2>\n<p>I have created an array (<strong>$customers_data<\/strong>) to store the customers details. You can create your own array as per your requirement:<\/p>\n<pre class=\"brush: actionscript3; gutter: true\">$customers_data = array(\r\narray(\r\n'customers_id' =&gt; '1',\r\n'customers_firstname' =&gt; 'Chris',\r\n'customers_lastname' =&gt; 'Cavagin',\r\n'customers_email' =&gt; 'chriscavagin@gmail.com',\r\n'customers_telephone' =&gt; '9911223388'\r\n),\r\narray(\r\n'customers_id' =&gt; '2',\r\n'customers_firstname' =&gt; 'Richard',\r\n'customers_lastname' =&gt; 'Simmons',\r\n'customers_email' =&gt; 'rsimmons@media.com',\r\n'customers_telephone' =&gt; '9911224455'\r\n),\r\narray(\r\n'customers_id' =&gt; '3',\r\n'customers_firstname' =&gt; 'Steve',\r\n'customers_lastname' =&gt; 'Beaven',\r\n'customers_email' =&gt; 'ateavebeaven@gmail.com',\r\n'customers_telephone' =&gt; '8855223388'\r\n),\r\narray(\r\n'customers_id' =&gt; '4',\r\n'customers_firstname' =&gt; 'Howard',\r\n'customers_lastname' =&gt; 'Rawson',\r\n'customers_email' =&gt; 'howardraw@gmail.com',\r\n'customers_telephone' =&gt; '9911334488'\r\n),\r\narray(\r\n'customers_id' =&gt; '5',\r\n'customers_firstname' =&gt; 'Rachel',\r\n'customers_lastname' =&gt; 'Dyson',\r\n'customers_email' =&gt; 'racheldyson@gmail.com',\r\n'customers_telephone' =&gt; '9912345388'\r\n)\r\n);<\/pre>\n<h2>STEP 2: Create a function to filter the data:<\/h2>\n<p>This function is used to detect double-quotes and escape any value that contains them. Without this an uneven number of quotes in a string can confuse Excel.<\/p>\n<pre class=\"brush: actionscript3; gutter: true\">\/\/ Filter Customer Data\r\nfunction filterCustomerData(&amp;$str) {\r\n$str = preg_replace(\"\/\\t\/\", \"\\\\t\", $str);\r\n$str = preg_replace(\"\/\\r?\\n\/\", \"\\\\n\", $str);\r\nif(strstr($str, '\"')) $str = '\"' . str_replace('\"', '\"\"', $str) . '\"';\r\n}<\/pre>\n<h2>STEP 3: Define file name and content header for download:<\/h2>\n<p>$file_name\u00a0variable is used to hold the name of the file and also define content header for download.<\/p>\n<pre class=\"brush: actionscript3; gutter: true\">\/\/ File Name &amp; Content Header For Download\r\n$file_name = \"customers_data.xls\";\r\nheader(\"Content-Disposition: attachment; filename=\\\"$file_name\\\"\");\r\nheader(\"Content-Type: application\/vnd.ms-excel\");<\/pre>\n<h2>STEP 4: Define Loop through each row in\u00a0 $customers_data<\/h2>\n<pre class=\"brush: actionscript3; gutter: true\">\/\/To define column name in first row.\r\n$column_names = false;\r\n\/\/ run loop through each row in $customers_data\r\nforeach($customers_data as $row) {\r\nif(!$column_names) {\r\necho implode(\"\\t\", array_keys($row)) . \"\\n\";\r\n$column_names = true;\r\n}\r\n\/\/ The array_walk() function runs each array element in a user-defined function.\r\narray_walk($row, 'filterCustomerData');\r\necho implode(\"\\t\", array_values($row)) . \"\\n\";\r\n}\r\nexit;<\/pre>\n<p>1. Define a variable $column_names which is used to print the column name in first row of excel.<br \/>\n2. Run a loop through each row and used array_walk()\u00a0 function to run each row in a user defined function.<\/p>\n<h2>STEP 5: Run script file in your environment:<\/h2>\n<p>If all goes well then the filename will be named &#8220;customers_data.xls&#8221; downloaded and saved in your computer. You can open this file in Excel which look like as following:<\/p>\n<p><a href=\"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/11\/Picture1-1.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-309958 size-full\" src=\"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/11\/Picture1-1.png\" alt=\"Run script file in your environment\" width=\"720\" height=\"151\" srcset=\"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/11\/Picture1-1.png 720w, https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/11\/Picture1-1-300x63.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/11\/export.txt\" target=\"_blank\" rel=\"noopener\">Click here<\/a> to download the complete code.<\/p>\n<div class=\"module_in_content_container\">\n<div class=\"module_content\">\n<p><img loading=\"lazy\" decoding=\"async\" class=\"module_image\" src=\"https:\/\/encrypted-tbn0.gstatic.com\/images?q=tbn:ANd9GcSVm91Annfm77tSj3KPtmd63LpFAfvWS2zBQA&amp;s\" alt=\"Knowband Blog- Troubleshooting Common PHP Issues in eCommerce Platforms\" width=\"100\" height=\"100\" \/><\/p>\n<div class=\"module_content_part\">\n<h3 class=\"title\">Troubleshooting Common PHP Issues in eCommerce Platforms<\/h3>\n<p class=\"module_content_text\">Learn how to troubleshoot common PHP issues in eCommerce platforms like PrestaShop, WooCommerce, OpenCart, and Magento with expert tips from Knowband.<\/p>\n<p><a class=\"link_2_to_module\" style=\"display: inline-block; color: #f36!important;\" href=\"https:\/\/www.knowband.com\/blog\/ecommerce-blog\/troubleshooting-common-php-issues-ecommerce-platforms\/\" target=\"_blank\" rel=\"noopener\"><span class=\"read-more\">LEARN MORE<\/span><\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<style>\n.module_in_content_container { display: flex; flex-direction: column; padding: 20px; border: 1px solid #ccc; font-size: 16px; line-height: 26px; box-shadow: 0 3px 0 #ebebeb; -webkit-box-shadow: 0 3px 0 #ebebeb; position: relative; margin-bottom: 1.5em; } .module_in_content_container>a { position: absolute; left: 0; top: 0; width: 100%; height: 100%; } .module_content { display: flex; align-items: flex-start; } .module_content img { max-width: 100px; margin-right: 20px; } .module_content_part p.module_content_text { margin-bottom: 10px; margin-top: 0; font-size: 18px; color: #000; } .module_content h3 { font-size: 24px; font-weight: 700; line-height: 1.5em; padding-left: 0; padding-top: 0; margin: 0; } .read-more { font-size: 18px; font-weight: 700; line-height: 1.5em; position: relative; display: inline-block; text-transform: uppercase; color: #f36; } .read-more:after { position: absolute; content: ''; width: 1.5em; height: 1.5em; top: -1px; right: -1.5em; background: url(https:\/\/knowband.com\/mobile-app\/wp-content\/uploads\/images\/readmore-arrow.svg) no-repeat center \/ .75em; transition: all .2s; } .read-more:focus, .read-more:hover { text-decoration: none; cursor: pointer; } .read-more:hover:after { right: -2em; transition: all .2s; } @media (max-width: 600px) { .module_content { flex-direction: column; align-items: center; text-align: center; } .module_content img { margin: 0 auto 20px auto; max-width: 100%; } .module_content .title { flex-basis: auto; margin-top: 20px; } .module_content_part p.module_content_text { font-size: 16px; line-height: 24px; } .read-more { font-size: 16px;}}<\/style>\n<p><span style=\"font-weight: 400;\">With 13+ years of excellence in information technology, we provide web and app development technologies on various frameworks. You can also explore a wide range of Prestashop, Opencart, WooCommerce, Shopify, and Magento 2 ready-to-use eCommerce extensions.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In case you have queries\/suggestions, you can reach out to our technical support portal at our email address <\/span><a href=\"mailto:support@knowband.com\"><span style=\"font-weight: 400;\">support@knowband.com<\/span><\/a><span style=\"font-weight: 400;\">.\u00a0<\/span>Take a look at our bestseller module <a href=\"https:\/\/www.knowband.com\/prestashop-one-page-supercheckout\">Prestashop One Page supercheckout<\/a> \u00a0and\u00a0\u00a0<a href=\"https:\/\/www.knowband.com\/opencart-mobile-app-builder\"><span data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;OpenCart eCommerce Mobile App&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:4224,&quot;10&quot;:2,&quot;15&quot;:&quot;Arial&quot;}\">OpenCart eCommerce Mobile App<\/span><\/a>.<\/p>\n<p>You can also watch our latest videos here:<\/p>\n<p><iframe loading=\"lazy\" title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/pfIUK9seCnw?si=2HNQYKDBwuTIqVal\" width=\"660\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>&nbsp;<\/p>\n<p><iframe loading=\"lazy\" title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/1yLcXToR6-g\" width=\"660\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Data\u00a0is any set of\u00a0characters that is translated for some purpose, like for analysis. It can be any character or value, including text and numbers, pictures, sound, or video. If data is not put into context then it does not do anything to a human being or machine. We generally export data from the websites to [&hellip;]<\/p>\n","protected":false},"author":29,"featured_media":816503,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kbui_enabled":"","footnotes":""},"categories":[1111],"tags":[18387,18388,18390,18389],"class_list":["post-309957","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tips","tag-export-php-data","tag-export-php-data-to-xls-file","tag-php-script","tag-steps-to-export-php-data"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Export PHP data to .xls file | PHP script | Technical Blogs by Knowband<\/title>\n<meta name=\"description\" content=\"In this blog learn how to export PHP data to .xls file step by step. With the help of PHP script you can export data to Excel and download it in a .xls file.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.knowband.com\/blog\/tips\/export-php-data-xls-file\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Export PHP data to .xls file | PHP script | Technical Blogs by Knowband\" \/>\n<meta property=\"og:description\" content=\"In this blog learn how to export PHP data to .xls file step by step. With the help of PHP script you can export data to Excel and download it in a .xls file.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.knowband.com\/blog\/tips\/export-php-data-xls-file\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowband Blog | Ecommerce Modules\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Knowband\" \/>\n<meta property=\"article:published_time\" content=\"2019-10-29T12:32:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-17T10:45:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/10\/Export-PHP-data-to-.xls-file.png\" \/>\n\t<meta property=\"og:image:width\" content=\"760\" \/>\n\t<meta property=\"og:image:height\" content=\"300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Varnit Singhal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@KnowbandPlugin\" \/>\n<meta name=\"twitter:site\" content=\"@KnowbandPlugin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Varnit Singhal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/export-php-data-xls-file\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/export-php-data-xls-file\\\/\"},\"author\":{\"name\":\"Varnit Singhal\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#\\\/schema\\\/person\\\/a884cf42a4b8d34e9826384c5da29e3e\"},\"headline\":\"Export PHP data to .xls file\",\"datePublished\":\"2019-10-29T12:32:42+00:00\",\"dateModified\":\"2025-11-17T10:45:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/export-php-data-xls-file\\\/\"},\"wordCount\":492,\"publisher\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/export-php-data-xls-file\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/10\\\/Export-PHP-data-to-.xls-file.png\",\"keywords\":[\"Export PHP data\",\"Export PHP data to .xls file\",\"PHP script\",\"steps to Export PHP data\"],\"articleSection\":[\"Tips\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/export-php-data-xls-file\\\/\",\"url\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/export-php-data-xls-file\\\/\",\"name\":\"Export PHP data to .xls file | PHP script | Technical Blogs by Knowband\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/export-php-data-xls-file\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/export-php-data-xls-file\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/10\\\/Export-PHP-data-to-.xls-file.png\",\"datePublished\":\"2019-10-29T12:32:42+00:00\",\"dateModified\":\"2025-11-17T10:45:36+00:00\",\"description\":\"In this blog learn how to export PHP data to .xls file step by step. With the help of PHP script you can export data to Excel and download it in a .xls file.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/export-php-data-xls-file\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/export-php-data-xls-file\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/export-php-data-xls-file\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/10\\\/Export-PHP-data-to-.xls-file.png\",\"contentUrl\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/10\\\/Export-PHP-data-to-.xls-file.png\",\"width\":760,\"height\":300,\"caption\":\"Knowband guide for Export PHP data to .xls file\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/export-php-data-xls-file\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Export PHP data to .xls file\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#website\",\"url\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/\",\"name\":\"Knowband Blog | Ecommerce Modules\",\"description\":\"Magento, Prestashop, Opencart, Shopify\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#organization\",\"name\":\"Knowband Blog | Ecommerce Modules\",\"url\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/09\\\/cropped-knowband_logo-v2.png\",\"contentUrl\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/09\\\/cropped-knowband_logo-v2.png\",\"width\":153,\"height\":61,\"caption\":\"Knowband Blog | Ecommerce Modules\"},\"image\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/Knowband\",\"https:\\\/\\\/x.com\\\/KnowbandPlugin\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#\\\/schema\\\/person\\\/a884cf42a4b8d34e9826384c5da29e3e\",\"name\":\"Varnit Singhal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/2019-11-06-150x150.jpg\",\"url\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/2019-11-06-150x150.jpg\",\"contentUrl\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/2019-11-06-150x150.jpg\",\"caption\":\"Varnit Singhal\"},\"url\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/author\\\/vsinghal\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Export PHP data to .xls file | PHP script | Technical Blogs by Knowband","description":"In this blog learn how to export PHP data to .xls file step by step. With the help of PHP script you can export data to Excel and download it in a .xls file.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.knowband.com\/blog\/tips\/export-php-data-xls-file\/","og_locale":"en_US","og_type":"article","og_title":"Export PHP data to .xls file | PHP script | Technical Blogs by Knowband","og_description":"In this blog learn how to export PHP data to .xls file step by step. With the help of PHP script you can export data to Excel and download it in a .xls file.","og_url":"https:\/\/www.knowband.com\/blog\/tips\/export-php-data-xls-file\/","og_site_name":"Knowband Blog | Ecommerce Modules","article_publisher":"https:\/\/www.facebook.com\/Knowband","article_published_time":"2019-10-29T12:32:42+00:00","article_modified_time":"2025-11-17T10:45:36+00:00","og_image":[{"width":760,"height":300,"url":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/10\/Export-PHP-data-to-.xls-file.png","type":"image\/png"}],"author":"Varnit Singhal","twitter_card":"summary_large_image","twitter_creator":"@KnowbandPlugin","twitter_site":"@KnowbandPlugin","twitter_misc":{"Written by":"Varnit Singhal","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.knowband.com\/blog\/tips\/export-php-data-xls-file\/#article","isPartOf":{"@id":"https:\/\/www.knowband.com\/blog\/tips\/export-php-data-xls-file\/"},"author":{"name":"Varnit Singhal","@id":"https:\/\/www.knowband.com\/blog\/fr\/#\/schema\/person\/a884cf42a4b8d34e9826384c5da29e3e"},"headline":"Export PHP data to .xls file","datePublished":"2019-10-29T12:32:42+00:00","dateModified":"2025-11-17T10:45:36+00:00","mainEntityOfPage":{"@id":"https:\/\/www.knowband.com\/blog\/tips\/export-php-data-xls-file\/"},"wordCount":492,"publisher":{"@id":"https:\/\/www.knowband.com\/blog\/fr\/#organization"},"image":{"@id":"https:\/\/www.knowband.com\/blog\/tips\/export-php-data-xls-file\/#primaryimage"},"thumbnailUrl":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/10\/Export-PHP-data-to-.xls-file.png","keywords":["Export PHP data","Export PHP data to .xls file","PHP script","steps to Export PHP data"],"articleSection":["Tips"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.knowband.com\/blog\/tips\/export-php-data-xls-file\/","url":"https:\/\/www.knowband.com\/blog\/tips\/export-php-data-xls-file\/","name":"Export PHP data to .xls file | PHP script | Technical Blogs by Knowband","isPartOf":{"@id":"https:\/\/www.knowband.com\/blog\/fr\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.knowband.com\/blog\/tips\/export-php-data-xls-file\/#primaryimage"},"image":{"@id":"https:\/\/www.knowband.com\/blog\/tips\/export-php-data-xls-file\/#primaryimage"},"thumbnailUrl":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/10\/Export-PHP-data-to-.xls-file.png","datePublished":"2019-10-29T12:32:42+00:00","dateModified":"2025-11-17T10:45:36+00:00","description":"In this blog learn how to export PHP data to .xls file step by step. With the help of PHP script you can export data to Excel and download it in a .xls file.","breadcrumb":{"@id":"https:\/\/www.knowband.com\/blog\/tips\/export-php-data-xls-file\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.knowband.com\/blog\/tips\/export-php-data-xls-file\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.knowband.com\/blog\/tips\/export-php-data-xls-file\/#primaryimage","url":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/10\/Export-PHP-data-to-.xls-file.png","contentUrl":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/10\/Export-PHP-data-to-.xls-file.png","width":760,"height":300,"caption":"Knowband guide for Export PHP data to .xls file"},{"@type":"BreadcrumbList","@id":"https:\/\/www.knowband.com\/blog\/tips\/export-php-data-xls-file\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.knowband.com\/blog\/fr\/"},{"@type":"ListItem","position":2,"name":"Export PHP data to .xls file"}]},{"@type":"WebSite","@id":"https:\/\/www.knowband.com\/blog\/fr\/#website","url":"https:\/\/www.knowband.com\/blog\/fr\/","name":"Knowband Blog | Ecommerce Modules","description":"Magento, Prestashop, Opencart, Shopify","publisher":{"@id":"https:\/\/www.knowband.com\/blog\/fr\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.knowband.com\/blog\/fr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.knowband.com\/blog\/fr\/#organization","name":"Knowband Blog | Ecommerce Modules","url":"https:\/\/www.knowband.com\/blog\/fr\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.knowband.com\/blog\/fr\/#\/schema\/logo\/image\/","url":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2016\/09\/cropped-knowband_logo-v2.png","contentUrl":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2016\/09\/cropped-knowband_logo-v2.png","width":153,"height":61,"caption":"Knowband Blog | Ecommerce Modules"},"image":{"@id":"https:\/\/www.knowband.com\/blog\/fr\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Knowband","https:\/\/x.com\/KnowbandPlugin"]},{"@type":"Person","@id":"https:\/\/www.knowband.com\/blog\/fr\/#\/schema\/person\/a884cf42a4b8d34e9826384c5da29e3e","name":"Varnit Singhal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/11\/2019-11-06-150x150.jpg","url":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/11\/2019-11-06-150x150.jpg","contentUrl":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/11\/2019-11-06-150x150.jpg","caption":"Varnit Singhal"},"url":"https:\/\/www.knowband.com\/blog\/author\/vsinghal\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/posts\/309957","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/users\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/comments?post=309957"}],"version-history":[{"count":15,"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/posts\/309957\/revisions"}],"predecessor-version":[{"id":833132,"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/posts\/309957\/revisions\/833132"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/media\/816503"}],"wp:attachment":[{"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/media?parent=309957"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/categories?post=309957"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/tags?post=309957"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}