Excel Data via copy & paste to an html form grid

Excel Data via copy & paste to an html form grid.

I have a client that is insisting on having an html form grid (that resembles Excel) that will allow them to copy and paste from the original excel document into this form. The data that’s copied and pasted into the html form grid will need to match the original excel document data cell by cell.

To do something like this, I would think you would need access to the systems clipboard (via javascript/php???) - I don’t think that this is something that is supported in all browsers if at all.

The client has turn down all other options of importing the excel data.

If anyone has any suggestions or ideas to how to get something like this to work, please let me know!

Excel exports tab-separated textonly clipboard, so you can catch onpaste/oninput on the grid and parse tsv into cells.

I’ve done this using one big <textarea> field. I just use copy and paste from the clipboard (as mentioned earlier, this will actually paste as tab delimited into the textarea). Then I just split on carriage returns, and split again on tabs. You’ll want to trim the data to get rid of any whitespace. I also typically have an intermediate page as a sanity check that presents the data in an HTML table to make sure it is formatted correctly before I start injecting it into MySQL.

This was the first option (just pasting into an textarea) I offered to the client and they felt that was too hard. :eek:

onpaste looks to be IE only - so I looking at what I can do with oninput

If copy and paste was too hard, I’m almost afraid to ask, but can they save the file as .csv or tab delimited and use the form “upload” option?