cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to populate an autofill KW set by a .xlsx file?

Evett_York
Champ on-the-rise
Champ on-the-rise

Is it possible to populate an autofill KW set by a .xlsx file?

3 REPLIES 3

Brian_Smith
Star Contributor
Star Contributor

Hey Evett,

This is not currently possible due to hidden formatting within the Excel file. However, you should be able to save the .xlsx file as a .csv file and process that.

Andres_Ronderos
Confirmed Champ
Confirmed Champ

Hi, I think there is a way via VBScript but I have never tried It

Try this

Sub GetKeywordSetRecords(primaryValue, context, results)

  'create de Excel object
  Set objExcel = CreateObject("Excel.Application")
  Set objWorkbook = objExcel.Workbooks.Open ("C:\Scripts\yourBook.xlsx")

  'Find the keyword value in the row
  for i=1 to YourExcelRows

      if objExcel.Cells(i,1).Value = primaryValue then
            value1= objExcel.Cells(i, 1).Value
            value1= objExcel.Cells(i, 2).Value
            value3=objExcel.Cells(i, 3).Value
        end if

  Loop

  'populate de keywords
  call results.BeginRow()
  call results.AddData("Invoice",primaryValue)
  call results.AddData("ID",value1)
  call results.AddData("Name",value1)
  call results.AddData("Value",CLng(value3))
  call results.EndRow()


  Set objExcel =nothing

End sub

I think It can be improved,  and if your excel sheet have to many rows could be slow.

 

Hope this help

Thomas_Reu
Elite Collaborator
Elite Collaborator

Or you can create an SSIS package that imports the data into a database table.  Then, if xlsx occurs on a regular basis you can schedule a SQL Server job to handle it.  Then you can create a database view to point to the now imported table, in case you need to do any data manipulation. Last, it's really easy create an external AFKS, that points to your view.