Announcement

Collapse
No announcement yet.

Read a xls file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Read a xls file

    How can I get the info that is in individual spreadsheet cells into a device string?
    I have searched, but not found what I wanted.
    I found one close, but i get an error-can not create active x... something?
    I do not have Excel on the HS machine, but I can use xls files with Microsoft Works.
    Using HS 2.3.0.19 on XPsp3

    Thanks,
    Tim

    Code:
    sub main()
    
    File1 = "C:\temp\Book1.xls"
    Set appXL = CreateObject("Excel.Application")
    appXL.Visible = True
    Set wkb = appXL.Workbooks.Open(File1)
    xlsWorkSheet = wkb.Worksheets(1).Name
    rngXL = wkb.ActiveSheet.Range("A1")
    hs.writelog "excel value", rngXL
    hs.SetDeviceString "A1", rngXL
    wkb.Close True, File1
    appXL.Quit
    Set appXL = Nothing
    
    End Sub
    FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

    HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

    #2
    I move a lot of data from Homeseer to excel but not from excel to Homeseer. If you want an automated method to move data from excel I would suggest you create a macro in excel to move the data you want to a standard .txt file. You can then have Homeseer read the data from the txt file into the device strings you want. I don't think you can read data directly from an excel spreadsheet when the cell contains a formula.

    Steve Q
    HomeSeer Version: HS3 Pro Edition 3.0.0.368, Operating System: Microsoft Windows 10 - Home, Number of Devices: 373, Number of Events: 666, Enabled Plug-Ins
    2.0.83.0: BLRF, 2.0.10.0: BLUSBUIRT, 3.0.0.75: HSTouch Server, 3.0.0.58: mcsXap, 3.0.0.11: NetCAM, 3.0.0.36: X10, 3.0.1.25: Z-Wave,Alexa,HomeKit

    Comment


      #3
      You can read the excel file using the objects for the Excel Document Object Model. It lets you navigate from workbook to workbook to worksheet to column to row to cell just as you do from the keyboard. Since there is so much more you can do with Excel than Notepad there is greater setup and options to deal with data in this format than in text file format.

      Comment

      Working...
      X