Access data from excel through business rules

sanjai
New Contributor

Hai everyone,

            I am trying to access the data from excel through business rule and use it in the business rule.If anyone know the VB.net code,please share with me. 

4 REPLIES 4

Steven
Contributor

You will need to have a third party tool like OpenXML.

Not sure if OneStream supports this after version 8, or if there is a specific third party tool that OneStream utilizes for this support.

JackLacava
Community Manager
Community Manager

I'm not sure I follow.

- if you want to produce arbitrary data through a BR in OneStream, for people to use in Excel, use TableViews. They will allow anyone with the OneStream Excel add-in to retrieve your custom tables of data.

- if you just want to retrieve OneStream Cube data from an Excel sheet, use the functions made available by the add-in. No need to code anything.

Henning
Valued Contributor

I agree! Not sure I understand the request. 

If you go down the route of using openXML, I would suggest to re-think the requirements and investigate the exact use case. There may be much simpler ways to solve this simply by adjusting the process, thereby also improving the user experience as well as audit trail. 

osdevadmin
New Contributor III

In some of the Thing Planning solutions, we have a way for user to upload excel files to build a initial dataset for the thing planning solution. You can explore those functions. For CSV we can do the following:

Imports System.IO 'Dependency for below code

1. Copy the file to OneStream file system

' Path to your CSV file 
Dim filePath As String = "path\to\your\file.csv"

2, Access the file using StreamReader

'AI Generated Code below
            Using sr As New StreamReader(filePath)
                While sr.Peek() >= 0
                    Dim line As String = sr.ReadLine()
                    ' Assuming the CSV values are separated by commas
                    ' Split the line into an array of values
                    Dim values() As String = line.Split(","c)
                    ' Process each value as needed
                    For Each value As String In values
                        Brapi.ErrorLog.LogMessage(si,value)
                    Next
                End While
            End Using