Paste from Spreadsheet/Excel

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
jlumpe
User
Posts: 11

Paste from Spreadsheet/Excel

Post by jlumpe »

I'd like to, if possible, add functionality to paste from a spreadsheet (Excel or Google Docs) into a "grid add" page. In my mind, it would go something like this: add custom server-side code to make a textbox and a "fill" button. The user pastes his spreadsheet data and clicks the button. There is then some custom javascript that parses the data in the box (default format is tab-delimited from Excel and Google docs, so pretty easy) and fills in the table with this information when the fill button is clicked.

This is pretty easy to do with JQuery. I'm just not sure how to select the correct text boxes (as in, 3rd text box of 5th row, etc). Any suggestions?

And is there a way to make this as a plugin as well?


mobhar
User
Posts: 11734

Post by mobhar »

Let's assume you are using MySQL database, then you may use MySQL import from file feature, such as: "LOAD DATA INFILE <filename> INTO TABLE <tablename>".

Here is another usage of that syntax:
LOAD DATA INFILE 'data.csv' INTO TABLE tbl_name
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;

For more information, please read: http://dev.mysql.com/doc/refman/5.1/en/load-data.html


jlumpe
User
Posts: 11

Post by jlumpe »

Thanks mobhar,

I'm actually using a Microsoft Access database, not MySQL. I'm trying to do this from the client-side only, using the same fields on the grid add page. That seems both simpler and better because the user can review the information and see that everything is in the right places. It's also necessary to use the lookup table functions of each field, so that the user can input the name of an employee rather than their ID, for instance.


mobhar
User
Posts: 11734

Post by mobhar »

Yes, "Grid-Add" is the closest approach to do this. In the backend process, you may import the data in Excel file to the temporary table first, afterwards load it into the Grid-Add page which then move the data to the permanent table and remove the data in the temporary table when user save the changes. Just my two cents. ;)


malsony
User
Posts: 39

Post by malsony »

I think Excel file or .csv file import is useful. We are developers or service providers, we know how to add a great deal of information to the database at a short time, but our end users do NOT know how to do so or have NO access to the database because of our limitation.


Post Reply