1

I am curious to know if anyone has ever found a way to dynamically create a XLS, pre-populated with a drop down field on each row? For example if I wanted to provide a client with a list of all their employees and next to each employee's name is a drop down pre-filled with a list of positions (developer, marketing, designer) for the client to select. The client then could reupload the XLS providing me with this new information. The reason for the drop down field is to provide easy options for the client to select, rather then forcing them to type them all out or copy and paste through the list.

I have searched high and low through PHP classes and Google Docs API, but I have not found a way to accomplish this. Before I give up on this path I thought I would ask the community.

I appreciate any help you can provide.

Help Inspire
  • 336
  • 5
  • 24
  • 1
    CSV is a comma delimited text file. Sounds like you want an Excel (XLS) file creator http://stackoverflow.com/questions/10595599/which-is-the-best-way-to-generate-excel-output-in-php – Waygood Apr 22 '13 at 12:40
  • CSV is just a flat-file data table. It doesn't have any UI-based features like drop-down menus. You would need to use e.g. a proper Excel spreadsheet file for this. But you would do much better to create a web page for the user to input this data IMO, rather than messing around with file uploads. – DaveRandom Apr 22 '13 at 12:41
  • I agree a web based form would be much simpler, but this request is client driven and they have not been convinced of a web form just yet. – Help Inspire Apr 22 '13 at 12:43
  • As for the use of an Excel (XLS), do you know if it's possible to generate a drop down within the file pre-populated with values via PHP? – Help Inspire Apr 22 '13 at 12:44
  • @HelpInspire Do the possible values for the drop-down change? – DaveRandom Apr 22 '13 at 12:45
  • 2
    http://phpexcel.codeplex.com/discussions/278878 – Waygood Apr 22 '13 at 12:47
  • In short yes. The values will be generated from a DB based on the customer ID. The values could be any string. – Help Inspire Apr 22 '13 at 12:47
  • This is not as trival as one might like then. The first thing to do would be to create the template document with a sample range of values, and then look at how to manipulate that range of values dynamically. If you have the misfortune of running on a Windows server it may actually help you here (if you can also install MS Office on it) because the COM interface for Excel will produce much better results. – DaveRandom Apr 22 '13 at 12:54
  • I have to say though, what you are talking about here is *so* nightmarish that you really need to impress on the customer that it is a terrible idea and what they need is a web form. You are in for a world of pain with this approach. – DaveRandom Apr 22 '13 at 12:55

1 Answers1

1

Thanks to Waygood this provides me with a path forward:

http://phpexcel.codeplex.com/discussions/278878

Which is the best way to generate excel output in PHP?

Much appreciated!

Community
  • 1
  • 1
Help Inspire
  • 336
  • 5
  • 24