Forum Discussion

mpatel1's avatar
mpatel1
New Contributor
2 years ago

Create a Function to read data from excel file in local file system Using BR api

I want to read a list of members from a excel file which is store in OS file system and store that list of member ID in a list to perform further calculation

  • SeanV's avatar
    SeanV
    New Contributor III

    I did something similar using a dashboard extender rule to get a file from a file share folder and load it to a custom table.  I know you are not trying to load to a custom table.  (I used BRApi.Utilities.LoadCustomTableUsingDelimitedFile)

    However BRApi.Utilities.GetFileShareFolder will grab the path of the file

    then maybe BRApi.Utilities.ReadExcelTableRangeContent ? will get the contents? sounds promising, might be worth a look.

  • RobbSalzmann's avatar
    RobbSalzmann
    Valued Contributor II

    Adding to SeanV 's suggestion for parsing your file, here's some code to help get you started getting a file into your rule to parse it:

    Dim objXFFileEx As XFFileEx = BRApi.FileSystem.GetFile(si, FileSystemLocation.ApplicationDatabase, fileFullName, includeContentFileBytes, failGracefully)
    Dim folderName As String = objXFFileEx.XFFile.FileInfo.FolderFullName 'Just an attribute
    Dim bytes As Byte() = objXFFileEx.XFFile.ContentFileBytes

     

    • mpatel1's avatar
      mpatel1
      New Contributor

      Actually I have a excel file at my OS document folder which contains a list of 100 members, I want help to access that file and store those member in a list variable using Extender BR

      • RobbSalzmann's avatar
        RobbSalzmann
        Valued Contributor II

        I think this would be easier if you uploaded the 100 members in a text file instead of an excel file. Other options include staging those members in a custom table.  Both easier than directly parsing excel, which i'm pretty sure will require a 3rd party library to be installed.