Thread: CSV related

Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    463
    Rep Power
    41

    CSV related


    Hi All,

    Can we have a drop down in CSV and can we import and export it?

    Thanks,
    Ranjan
  2. #2
  3. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6351
    You're going to have to expand on nearly every word in this post.

    The short answer is: No. CSV is a plaintext data type which is literally values with commas between them. That is all there is, there is no other possible thing aside from a list of values with commas. It can be viewed in notepad (or any other plaintext editor) and has no inherent interface elements.

    Now if you meant an EXCEL file, then yes excel files can have drop-downs for allowable values. If that's what you meant, explain what "import" means in this context, what you're importing into, how you're fetching the data, and what you plan on doing with it.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    463
    Rep Power
    41
    Hi ManiacDan,

    Thanks for your response.

    I have a database table that contains various industry names like Palm Oil, Gem and Jewels etc...this way this table has app..100 various industry names

    Secondly, I have a table that holds, industry specific values. User need to fill up a form and these values are inserted in this table.

    I can bulk populate this table via CSV using normal CSV without any select box in csv.

    Can I have a drop down select box in CSV and can I upload such a CSV in database using PHP?

    If it can not be done then can it be done using EXCEL? Means bulk uploading the records using excel with select box.

    How can this be done using CSV or EXCEL.

    Thanks,
    Ranjan
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2010
    Posts
    153
    Rep Power
    5
    As stated, you cannot have a drop-down box in a CSV. What you can do is have a drop-down box in Excel, then export the Excel sheet to a CSV.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    463
    Rep Power
    41
    Not very clear.....you mean...I can have a drop down in excel and then convert that in csv and import...correct?
  10. #6
  11. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6351
    Why do you believe you need a drop-down at all? What purpose is this drop-down serving? You cannot have a drop-down in ANYTHING you import into a database because a drop-down, by definition, contains a large list of items, only ONE of which is the selected value.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    463
    Rep Power
    41
    For bulk upload users will put all records in the CSV and I need to do reporting on the basis of industry so industry name should be correct so that I can access the records on the basis of industry.

    Originally Posted by ManiacDan
    Why do you believe you need a drop-down at all? What purpose is this drop-down serving? You cannot have a drop-down in ANYTHING you import into a database because a drop-down, by definition, contains a large list of items, only ONE of which is the selected value.
  14. #8
  15. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6351
    Your problem has nothing to do with drop-downs. Your problem is inconsistencies in your data. Your possible solutions:

    1) Reject any uploads which do not match an existing industry.

    2) Create for yourself a "repair" page where any industries which are in the database which do not match the "official" list can be automatically repaired by choosing the right one from a list.

    3) Have whoever is doing the upload select from a drop-down in their excel file, then export the results (I'm not sure how well this would work, given that CSV has no concept of drop-downs)
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    463
    Rep Power
    41
    Thanks

    Originally Posted by ManiacDan
    Your problem has nothing to do with drop-downs. Your problem is inconsistencies in your data. Your possible solutions:

    1) Reject any uploads which do not match an existing industry.

    2) Create for yourself a "repair" page where any industries which are in the database which do not match the "official" list can be automatically repaired by choosing the right one from a list.

    3) Have whoever is doing the upload select from a drop-down in their excel file, then export the results (I'm not sure how well this would work, given that CSV has no concept of drop-downs)
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2010
    Posts
    153
    Rep Power
    5
    Originally Posted by ranjangoyal
    Not very clear.....you mean...I can have a drop down in excel and then convert that in csv and import...correct?
    That's essentially what I mean. I guess what you want is some sort of data entry interface that will ensure data integrity.

    You could conceivably build such a thing in excel, then export the excel sheet to a CSV (in excel), making sure to flatten the drop-downs to the current value (I'm not an excel wonk so I can't help you there, but I'm fairly sure it's doable).

    Not the way I'd choose to do it, but then again I don't know what constraints you're up against.
  20. #11
  21. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    463
    Rep Power
    41
    Hi,

    Is it possible to convert excel file to csv file on the fly...means I will upload excel and script converts it into csv and then I process CSV to insert data in db....possible?


    or is there any script that can read excel under LAMP....I have script that reads excel under WAMP

    Thanks,
    Ranjan
    Last edited by ranjangoyal; August 20th, 2013 at 11:41 AM.
  22. #12
  23. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2004
    Posts
    2,998
    Rep Power
    375
    what I think (could be wrong) you need is: a form with a drop down with all companies. and a file upload (csv). This way you can connect the csv with a company without resorting to what you are trying to do now.
  24. #13
  25. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    463
    Rep Power
    41
    Users of the system make mistakes while entering data so.. I need drop downs for industry names in excel as csv doesn't support drop downs ...and then I need to feed database with this information...this is where

    either I need to read excel or I need to convert excel to csv on the fly to process

    so that to populate the database


    Originally Posted by paulh1983
    what I think (could be wrong) you need is: a form with a drop down with all companies. and a file upload (csv). This way you can connect the csv with a company without resorting to what you are trying to do now.
  26. #14
  27. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2010
    Posts
    153
    Rep Power
    5
    Originally Posted by ranjangoyal
    Hi,

    Is it possible to convert excel file to csv file on the fly...means I will upload excel and script converts it into csv and then I process CSV to insert data in db....possible?


    or is there any script that can read excel under LAMP....I have script that reads excel under WAMP

    Thanks,
    Ranjan
    There's this:

    http://code.google.com/p/php-excel-reader/

    Though it's for xls files, not xlsx. There may be a library out there that handles xlsx too.

    I've used it to import excel into PHP/MySQL (on a LAMP), though I don't know what it will make of a dropdown.

    Otherwise, there are (at least) perl, java, and python libraries on Linux for reading excel, you could make a converter in one of those languages and call it from your code.
  28. #15
  29. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2004
    Posts
    2,998
    Rep Power
    375
    i am still not sure what you are trying to do.

    When a user does an upload (CSV file) look at the company column and use an algorithm to determine how closely it matches one of the company in your database, if it is 90%+ then replace user input company with that one. if it is less, display that row to the user and THEN give a drop down of companies. This way is far better.

    Also if users make mistakes with company, then how do you propose checking other details they may be entering for a company?
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo