I have a Python script to convert the CSV file to base64.
import base64
file = open("D:\test.csv", 'rb')
base64_csv = base64.b64encode(file.read()).decode('utf-8')
I need to write a Powershell to do the same thing due to company recruitment. I tried this module but doesn't work:
$csv = Import-Csv -Path "D:\test.csv"
base64_csv = [System.Convert]::ToBase64String([char[]]$csv)
Cannot convert the "@{My CSV File content}" value of type
"System.Management.Automation.PSCustomObject" to type "System.Char[]".
I am very new to Powershell, any help is appreciated!