11-25-2021 04:13 AM
Hello everyone,
i would like to access the titles of the worksheets in an Excel file via a selection list in the user dialog. When selecting the title via the selection list in the user dialog, the respective title should be loaded into the data portal.
Can someone help me with this?
Best regards
Alexander
12-09-2021 12:49 AM
Hello Alexander,
May I ask if you had a chance to review the following articles?
Best regards.
12-10-2021 01:08 AM
Hi Alexander_18,
The first thing is that you need a DataPlugin – as Edgar mentioned in his links.
Then you have two options.
The first option is very easy and does not need any further script code. If the folder is part of the “Search Areas”, then you can open the structure (root, groups, channels) of the Excel file and you can select the group which should be loaded.
In the second option you need to create a script. Below you find an example for reading the channel groups:
Dim oMyDataFinder, oMyConditions, oMyResults, oMyQuery, oElem, sFolder, sExcelFileName, sGroupSelected
sFolder = "DriveName:\Folder\"
sExcelFileName = "FileName.xlsx"
Set oMyDataFinder = Navigator.ConnectDataFinder("My DataFinder")
Set oMyQuery = oMyDataFinder.CreateQuery(eAdvancedQuery)
oMyQuery.ReturnType = eSearchChannelGroup
Set oMyConditions = oMyQuery.Conditions
'--- Fill the query
Call oMyConditions.Add(eSearchFile, "folder", "=", sFolder)
Call oMyConditions.Add(eSearchFile, "fileName", "=", sExcelFileName)
oMyConditions.Logic = "C1 AND C2"
Call oMyDataFinder.SearchElements(oMyQuery, 20000)
Set oMyResults = oMyDataFinder.ResultsElements
for each oElem in oMyResults
' used to fill the combo box
msgbox oElem.Name
next
' ....
sGroupSelected = oMyResults(2).Name
Call DataFileLoadSel(SFolder & sExcelFileName, "Mergeliste_import", sGroupSelected & "/*", "LoadImmediately|ChnXYRelation")
Greeting
Walter