开发者

Excel import with no pre-defined structure

Background: At the moment in my MVC application I am importing excel file succesfully with a defined layout of the excel sheet (as in I have told the client the file columns have to be in a specified order and start rows have to start at row 1) Now this works fine.

TO DO: But the new requirement from the client is that they want the ability to upload an excel file without a pre-define structure (so the columns can be in any order and row can 开发者_StackOverflowstart from 1- 10)

Has anyone come across a similar requirement and successfully implemented it and can give me some pointers on how to get this working. I am assuming after they upload the excel file i need to show them some kind of excel sheet representation where they can input the column mapping between there uploaded structure and my structure ? Any Ideas?

Thanks for the help.


I did something similar and made the requirement that the column header/name be from a predefined pool (differentiated by optional/mandatory) - so the order of columns wouldn't make a difference when importing the data... I made the comparison between the "column name pool" and the column names from the uploaded file a bit "fault-tolerant" by stripping away whitespace (Trim) and compare it case-insensitive...

This worked fine and allowed my app to display specific error message like "column xy missing" or "found unknown column z"... later the client asked for a setting to allow overriding the error handling - i.e. "just discard unknown columns" or "store them without any functionality on them"...

The app displayed optionally an "import report" detailing what has been done throughout the import process so they could accept/deny.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜