Importing Excel data to Drive Simulation

Forum Forums Visual Components 4.0 General Product Questions Importing Excel data to Drive Simulation

Visual Components Essentials has been officially released, download link

Be sure to read the Forum Rules and Guidelines before start using the Forum.

Tagged: ,

This topic contains 7 replies, has 3 voices, and was last updated by  wangchengyang 4 days, 19 hours ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #3051

    wangchengyang
    Participant

    Hi,

    I want to use the data in a Excel file to drive my simulation automatically. I downloaded the xlrd library, but what should I do before I can use the library.

    Best wishes

    #3059

    rgambord
    Participant

    Hello,

    I spent a lot of time trying to do the same, using the openpyxl library. One way to load external libraries is to put them directly into the python directory C:\Program Files\Visual Components\Visual Components Professional 4.0\Python\lib

    However, Visual Components has a bug in the stackless python environment wherein importing an external library works the first time a file is opened, but if you go File->Clear All, or simply open a different file without closing Visual Components, and then try to import the library again, the import will often fail. You must restart VC to reset the python environment.

    #3061

    rgambord
    Participant

    To find a list of all of the path directories into which you can place external libraries, simply add a script behaviour to a component, enter the following:

    import sys
    print "\n".join(sys.path)
    #3097

    wangchengyang
    Participant

    Hi,

    I put the library into C:\Program Files\Visual Components\Visual Components Professional 4.0\Python\lib\site-packages, but it does not work. Should I install it first?How? Attachments are the library file.

    Best wishes.

    Attachments:
    You must be logged in to view attached files.
    #3114

    rgambord
    Participant

    Did you put an __init__ file in the site packages directory?

    #3130

    wangchengyang
    Participant

    I’ve solved the problem! Thanks for your advice, it helps a lot 🙂

    #3598

    Captain_Feature
    Participant

    Hey wangchengyang,

    how could you solve the problem?

    Please share the way you solve it… 🙂

    #3614

    wangchengyang
    Participant

    Unzip the attached file, and put the folder openpyxl into the directory C:\Program Files\Visual Components\Visual Components Professional 4.0\Python\lib\site-packages

     

     

     

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.