Automate the import of data from CSV/Excel

Modified on Fri, 17 Jun 2022 at 12:45 PM

# Define the Import Contract – Needs to be on the server somewhere. Use the portal to upload it if you do not have access

$contractFilePath = "$($ScriptArgs.ReportsFolder)\..\Scripts\ImportContracts\ImportContract.txt"


# Do the import

$ImportEvent = Import-MsModuleData -Module Applications -ImportFilePath "D:\MStudioImportFolder\ImportFile.csv" -ContractFile $contractFilePath


# Log the results, these are the same as you see in the UI

Write-MSDebug -LogText "$($ImportEvent.GetReport($true, 'Users'))"