Office Integration Pack Import Excel Range RRS feed

  • Question

  • Hi Guys,

    This is my first time using Office Integration Pack. I'm using Lightswitch 2011 and I'm trying to import data from excel. 

    My ultimate goal is to import different range of excel sitting in different tabs into one table in LightSwitch

    Therefore, I started with a simple import process, I'm not getting any error but I'm not seeing the data imported either in my screen

    Please see below 

    Here is my excel file that I'm importing 

     photo ExcelModel.png

    Here is my LS Code 

            Private Sub ExportToExcel_Execute()
                ' Write your code here.            
                Dim ExcelFile As String = "\\ServerName\corpdata\2014 Budget\22 Pack\STR\Monthly\January Thru April\Courtyard Houma\Test.xlsx"
                'If File.Exists(ExcelFile) Then
                '    OfficeIntegration.Import(Me.Hotels, ExcelFile, "Response", "C28:L28")
                '    OfficeIntegration.Export(Me.Hotels, ExcelFile, "Response", "C28:L28")
                'End If
                Dim mappings As New List(Of OfficeIntegration.ColumnMapping)
                mappings.Add(New OfficeIntegration.ColumnMapping("STRID", "STRID"))
                mappings.Add(New OfficeIntegration.ColumnMapping("HotelName", "HotelName"))
                mappings.Add(New OfficeIntegration.ColumnMapping("CitynState", "CitynState"))
                mappings.Add(New OfficeIntegration.ColumnMapping("ZipCode", "ZipCode"))
                mappings.Add(New OfficeIntegration.ColumnMapping("Phone", "Phone"))
                mappings.Add(New OfficeIntegration.ColumnMapping("RA", "RA"))
                mappings.Add(New OfficeIntegration.ColumnMapping("OpenDate", "OpenDate"))
                OfficeIntegration.Excel.Import(Me.Hotels, ExcelFile, "Sheet2", "A1", mappings)
            End Sub


    • Edited by Codernater Thursday, July 17, 2014 4:06 PM Server Correct Name
    Thursday, July 17, 2014 4:05 PM


  • Found the solution

    OfficeIntegration.Excel.Import(Me.Hotels, ExcelFile, "Sheet2", "A1:G7", mappings)


    • Marked as answer by Codernater Thursday, July 17, 2014 7:04 PM
    Thursday, July 17, 2014 7:04 PM