Current Code:
' send http post request
objHTTP.Send (payload)
' response is a CSV formatted string
Dim response
response = objHTTP.responseText
If objHTTP.Status = "200" Then 'success
' add response to some worksheet
ThisWorkbook.Names("some_cell").RefersToRange.Value = response
Else
Debug.Print "Something Went Wrong!"
End If
Problem:
The entire csv string is being added to a single cell (not surprising since my named_range is a single cell), but I don't know what needs to be updated to get this working correctly.
Correct behavior would be adding the CSV string to the worksheet in the same manner as if excel was opening a .csv file.
SplittheresponseandResizethe range to match the resulting arraySplit(response, vbCrLf)to get an array of lines, dump those to the worksheet, then use Text To Columns to separate the fields. Or write the response to a temporary file and open it with Excel if you want to leverage Excel's ability to do the parsing.