Ephraim Malane · Oct 13, 2022

How to convert xlsx to csv

Hi ommunity,

I am downloading an Excel xlsx from the web with the below method and saving it as xlsx, how do I convert and save xlsx as csv?

ClassMethod DownloadFileUrl()
        Set httprequest = ##class(%Net.HttpRequest).%New()
        Set httprequest.Server = ""
        Set httprequest.SSLConfiguration = "SSL_OAUTH_Client"   
        Do httprequest.Get("/wp-content/uploads/2021/04/ICD-10_MIT_2021_Excel_16-March_2021.xlsx")
        write httprequest.HttpResponse.StatusLine         
        Set stream=##class(%FileBinaryStream).%New()
        Set stream.Filename="/home/Data/March_2021.xlsx"

        Write stream.CopyFrom(httprequest.HttpResponse.Data)
        Write stream.%Save()
        Write stream.%Close()
Product version: IRIS 2020.2
1 172
Discussion (3)1
Log in or sign up to continue