Importing the JSON file into Excel:
Export from Excel into JSON fileSub M_snb_import() c00 = Replace(Replace(Replace(Replace(CreateObject("scripting.filesystemobject").opentextfile("G:\OF\sigma.json").readall, Chr(34), ""), "\u00df", "ß"), "\u00fc", "ü"), "\u00dc", "Ü") ReDim sp(UBound(Split(c00, vbCrLf)) + 1, 2 * UBound(Split(c00, "[{" & vbCrLf))) sn = Split(c00, "[{" & vbCrLf) For jj = 0 To UBound(sp, 2) \ 2 st = Split(sn(jj), vbCrLf) For j = 0 To UBound(st) If InStr(st(j), "{") + InStr(st(j), "}") = 0 Then sv = Split(Trim(st(j)), ":") sp(y, jj) = Trim(sv(0)) If UBound(sv) = 1 Then sp(y, jj + 1) = Trim(sv(1)) y = y + 1 End If Next Next Cells(20, 1).Resize(UBound(sp), UBound(sp, 2)) = sp End Sub
Sub M_snb_export() sn = Cells(20, 1).CurrentRegion y = 1 For j = 1 To UBound(sn) c00 = c00 & Space(8 * y) & Chr(34) & sn(j, y) & Chr(34) & ": " If sn(j, y + 1) = "" Then c00 = c00 & "[{" & vbCrLf y = y + 1 Else c00 = c00 & Chr(34) & sn(j, y + 1) & Chr(34) & vbCrLf End If Next c00 = c00 & Replace(Space(y - 1), " ", "}]" & vbCrLf) c00 = Replace(Replace(Replace(c00, "ß", "\u00df"), "ü", "\u00fc"), "Ü", "\u00dc") createobject("scripting.filesystemobject").createtextfile("G:\OF\snb.json").write "{" & vbCrLf & c00 & "}" End Sub




Reply With Quote