Forum Discussion
osdevadmin
10 months agoNew 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