No announcement yet.

Reading Data from an Excel File

  • Filter
  • Time
  • Show
Clear All
new posts

  • Reading Data from an Excel File

    Not sure where this should be posted so I'll start here. I have an application where I have a database or a chart that is maintained in Excel. I would like to be able to enter a say a part number and the PLC go to an excel file and look up a configuration. Basically this configuration tells what inputs should be on for a given part. This is a simple explanation. If I have a part xyz then it starts a check to see if inputs 1,3,4,5 are on. If they are on then the part checked ok. If inputs 2,3,4,5 are on then it is bad. However if I enter zyx it looks to see if 2,3,5 are on and so forth blah blah blah. Point is, I want to maintain the data file in excel, compare a part number to a column in the file, then pull data from it. Just curious if this can be done and if so, with what hardware.

  • #2
    Should have ask.....Is this a Think & Do type application?


    • #3
      I would imagine that someone experienced with VBA could get Excel to sent the data to the PLC (might possibly need a communications library/driver if using Modbus). But I have a hard time imagining a PLC parsing an XLS file, a comma delimitated file maybe. But I don't know if many PLCs have the ability to open a text file on a network. The Do-More can open a file on a SD card, but that would not allow "maintain[ing] the data file in Excel" in real time. If changes are rare and you don't mind using "sneaker net*" it might be a possibility, but I still don't know how easy parsing the file would be.

      * latency is hell, but nothing beats the bandwidth of a cargo plane full of SD cards


      • #4
        In essence, my application may be more of like a recipe look up of sorts. I just need the plc to pull up a few values based on a part number entered in by the HMI. Could the HMI possibly do it?
        If you type in a part number in the HMI, it would go to an excel file and then pull about 10 values into the PLC.


        • #5
          there are several HMI's that have a recipe function that might be able to do what you are looking for.

          I have also wrote some python code that parses a CSV that is updated by an external computer program and sends out the data via modbus. With some work it might be adaptable to this application


          • #6
            Ok, so I have been experimenting with the C-More. It will partially do exactly what I want, and I feel as though it should be able to do the rest of it, but I cannot figure out how to do it. In C-More I can use the recipe function and update the machine with a CSV file from excel. It will be generated in the correct format for the C-More and maintained outside the C-more and PLC. However, in the C-More recipe function, it requires you to pull up a recipe from a recipe sheet by requesting the Dest number in the recipe sheet which is 1, 2, 3,4,......1000. These are useless. I would like to populate those registers 1,2,3,.....1000 with a part number and pull them up that way. I had planned on populating the Name column with the part number and pulling it up that way but can't get it to work. Note that I am gonna hook up a barcode scanner and pull the part number into the recipe request register to automatically load the recipe.

            Is this possible?