简体   繁体   中英

Export Mysql data to a customized XLS file using php

First of all, I do know the process of exporting MySQL data to excel file using php. But I have some specific requirement and I want to know if it can be done or not. I have already googled, but didn't get any specific information or method regarding the same.

This is my xls template :

在此处输入图片说明

Overview:

Column C is fixed and others are scrollable. There are basically couple of organizations.

Data starting from COL-C8 to COL-L8 is exactly stored on a MySQL Table of an organization (eg Organization1).

Data of COL-C1 to COL-C5 & D1 to D5 is on another MySQL Table of Organization1.

So for every organization there are 2 different MySQL tables.

Requirement :

The goal is to export data from MySQL and add it to the excel file according to the image above.

Problem :

Adding data from MySQL table to excel is pretty easy if the requirement is to just replicate same on the excel sheet. But I have no idea how to do this customization.

Like pulling data from two different tables and adding them to different columns in an excel sheet.

Please let me know if it is possible. And if yes, then kindly direct me to some references on how to achieve this.

Thank You!

Try PHPExcel . This library allows you to read and write from/to .xls files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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