Is it possible to write a program that change the order of columns in sheet1(excel) based on a table in standard sheet2(excel)?
Sheet1 have the same header of each column as sheet2 but the position of columns is not same and also it is possible that some more columns are present in sheet(1). Finally I have to store the standard sheet into the database.
Yes it possible to change the order of columns.
Steps:
Change the excel sheet format file to csv file.
Write a PHP code to arrange the random columns as per the standard sheet.
Write a code to enter this data into the database. Each time you receive the new column append it at the last of the standard column.
Make the respective change in the PHP code for the same.
This is probably a dumb answer, but back in the day I used VB code inside of Excel workbooks to manipulate data including culling information from one worksheet and creating another based on contents.
Try http://msdn.microsoft.com/en-us/library/office/ee814737(v=office.14).aspx for more information.
Related
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 (e.g. 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.
We have a local site written in PHP, which contains some data in table format (index.php). It is a dynamically generated data/table, so I'm not able to access the database behind it.
Is there any way I can read the table in that web page, and write it to a text file in the same table format using perl/php/python?
The table is a huge one with around 1000 rows. But I need only the top 10 rows (sorted based on one of the columns).
Please help.
In PHP you can use file_get_contents() function to get the whole html of any page, than you can filter your required content and save it in a text file using fopen() and fwrite().
I have a list of barcodes changes every day, and there is no specific count of these barcodes, I want to store them into a file, I thought about excel but the problem that it is changing the value of the barcode.
as example I have a barcode '4903047158887' and excel declare it as '4.90305E+12' and that won't work, because when I convert it to CSV file It copy the same value to CSV.
What is the best file type I should use to effectively imported with PHP to mysql table in specific columns only not rows and is there a PHP code to do this work?
I am having a number of different excel sheets at my end. I need to put their data in the database. There are some predefined fields in database (country,code,start date, end date) which I need to fetch from excel and need to put in the database.
Tried so far :
I have fetched the data and putting it in the database when i know the field names of excel sheets. For example if excel is also having (country,code,start,end) then my code is taking and putting in the data base exactly
Problem
I want this to be automatic upload to database in case the excel fields are not same as i using in my code. Explaining furhter , suppose in my excel fields are (location,location code, starting date, end date). then I also want my program to extract the data from proper field.
I want some kind of mapping utility at my panel so that admin can map the fields once a new excel sheet with new fields are uploaded. so that it maps and fetch the data from proper columns of excel sheets.
Please suggest how to start it with.
Thanks,
You can use library like
http://code.google.com/p/php-excel-reader/
And do a custom app which have admin can select the fields in db for the read columns in excel.
Let's go ahead and get this out of the way - i realize I can generate tables with php and mysql and output in 'almost' any format I need but in this scenario, the excel spreadsheet is formatted in some strange ways (layout, color, etc) and the client won't budge. I have to use the exact excel spreadsheet.
I am trying to pull data from a mysql database with php calculations behind it and populate various cells within an Excel file. Is it possible to do this?
Thank you ahead of time
You can try PHPExcel ( http://phpexcel.codeplex.com/). I think this is what you are looking for.