I have curated a file that concatenates form data and generates a JSON code string. Currently, the user has to copy the output into word and then copy that output from word into notepad++ to remove the extra quotations that excel adds when using the Concat function and directly pasting it into notepad++ or seemingly anything non-Microsoft.
However, the next evolution of this template would be a macro button that generates a .json file ready to be pushed into our repository or a local file system. Is this possible? How would you push a single cell into a text file and then save it as a .JSON with a filename generated from the name cell that populates the code?
I've attached the Concat function, the output directly into Notepad++, and the "correct" output that can be achieved by pasting into word first, then Notepad++
The concat function:
=CONCAT("{
",CHAR(34),"job",CHAR(34),":
{
",CHAR(34),"name",CHAR(34)," : ",CHAR(34),[NAME CELL],CHAR(34),",","
",CHAR(34),"domo",CHAR(34)," : {
",CHAR(34),"dataPartSize",CHAR(34)," : ", [DATEPARTSIZE CELL] ,CHAR(44),"
",CHAR(34),"dataSet",CHAR(34)," : {
",CHAR(34),"transport",CHAR(34)," : {",,CHAR(34),"type",CHAR(34)," : ",CHAR(34),"API",CHAR(34),", ",CHAR(34),"version",CHAR(34)," : 1},
",CHAR(34),"updateMethod",CHAR(34)," : ",CHAR(34),[UPDATE METHOD CELL],CHAR(34),",
",CHAR(34),"dataProvider",CHAR(34)," : {",CHAR(34),"key",CHAR(34)," : ",CHAR(34),"api",CHAR(34),", ",CHAR(34),"name",CHAR(34)," : ",CHAR(34),"API",CHAR(34),"},
",CHAR(34),"dataSource",CHAR(34)," : {",CHAR(34),"name",CHAR(34)," : ",CHAR(34),[NAME CELL],CHAR(34),", ",CHAR(34),"description",CHAR(34)," : ",CHAR(34),[DESRIPTION CELL],CHAR(34),"},
",CHAR(34),"schemaDefinition",CHAR(34)," : {
",CHAR(34),"columns",CHAR(34)," : [
",CONCAT([EXCEL TABLE OF COMBINED COLUMN VALUES FORMATTED WITH DATA TYPE inc. whitespace indentation]),"
"," ]
}
}
}
}
}
")
The output, with some dummy values, when directly copying into Notepad++
"{
""job"":
{
""name"" : ""DEFAULT_NAME"",
""domo"" : {
""dataPartSize"" : 2000,
""dataSet"" : {
""transport"" : {""type"" : ""API"", ""version"" : 1},
""updateMethod"" : ""REPLACE"",
""dataProvider"" : {""key"" : ""api"", ""name"" : ""API""},
""dataSource"" : {""name"" : ""DEFAULT_NAME"", ""description"" : ""This is the Description""},
""schemaDefinition"" : {
""columns"" : [
{""name"" : ""Test1"", ""type"" : ""STRING""},
{""name"" : ""Test2"", ""type"" : ""STRING""},
{""name"" : ""Test3"", ""type"" : ""STRING""},
{""name"" : ""Test_Date"", ""type"" : ""DATE""}
]
}
}
}
}
}
"
The output when pasted into word and then afterwards, Notepad++, which forms the "correct" JSON output that we currently have to save and name:
{
"job":
{
"name" : "DEFAULT_NAME",
"domo" : {
"dataPartSize" : 2000,
"dataSet" : {
"transport" : {"type" : "API", "version" : 1},
"updateMethod" : "REPLACE",
"dataProvider" : {"key" : "api", "name" : "API"},
"dataSource" : {"name" : "DEFAULT_NAME", "description" : "This is the Description"},
"schemaDefinition" : {
"columns" : [
{"name" : "Test1", "type" : "STRING"},
{"name" : "Test2", "type" : "STRING"},
{"name" : "Test3", "type" : "STRING"},
{"name" : "Test_Date", "type" : "DATE"}
]
}
}
}
}
}