Skip to main content
Newcomer
Aug 16, 2023 9:37 PM UTC

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

5 replies

RobbSalzmann
Employee - Advisor
Employee - Advisor
Aug 17, 2023 1:52 PM UTC

Which part of your code do you need help with?

mpatel1Author
Newcomer
Aug 17, 2023 8:00 PM UTC

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
Employee - Advisor
Employee - Advisor
Aug 18, 2023 2:02 PM UTC

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.

Aug 18, 2023 12:48 PM UTC

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
Employee - Advisor
Employee - Advisor
Aug 18, 2023 1:59 PM UTC

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