Quickest Way to Import XML and output to Azure Blob in CSV format

Nathaniel B Szypulinski 21 Reputation points
2022-09-28T13:02:56.26+00:00

I was wondering what is the quickest way to receive a xml file and be able to convert to csv and put into azure blob.

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,639 questions
{count} votes

Accepted answer
  1. shiva patpi 13,171 Reputation points Microsoft Employee
    2022-09-29T01:08:02.737+00:00

    Hello @Nathaniel B Szypulinski ,
    I was thinking the quick way is to use the PowerShell script.

    $xmlfilePath = "C:\azure\xmlfilename.xml" (if the file is remote then use: (Invoke-webrequest -URI "path").Content > $xmlfilePath )
    $csvfilePath = "C:\azure\filename.csv"
    [xml]$XmlFileContent = Get-Content -Path $xmlfilePath
    $XmlFileContent.catalog.ChildNodes | Export-Csv -Path $csvfilePath -NoTypeInformation -Delimiter:","
    //above code was to convert xml to csv
    //below code is to upload that csv to blob storage account

    $uploadstorage=Get-AzStorageAccount -ResourceGroupName "resourcegroupname" -Name "storageaccountname"
    $storcontext=$uploadstorage.Context
    Set-AzStorageBlobContent -Container "containername" -File $csvfilePath -Context $storcontext

    0 comments No comments

0 additional answers

Sort by: Most helpful