Synthoid / ExportSheetData

Add-on for Google Sheets that allows sheets to be exported as JSON or XML.
MIT License
236 stars 46 forks source link

Export column as keys #82

Closed imtrobin closed 5 years ago

imtrobin commented 5 years ago

Hi, I'm trying to export spreadsheet as JSON with localization data e.g

          EN    |  IT     |  FR

ID1 "en1" "it1" "fr1" ID2 "en2" "it2" "fr2"

I would like the export JSON to be

{ "EN" : { "ID1": "en1", "ID2":"en2" } "IT" : { "ID1": "it1", "ID2":"it2" } "FR" : { "ID1": "fr1", "ID2":"fr2" } }

Synthoid commented 5 years ago

Hmm, would you be able to provide the full context of your data? As is, the easiest thing to do would be to structure your data like so:

CODE | ID1 | ID2
EN | en1 | en2
IT | it1 | it2
FR | fr1 | fr2

Which would produce the following:

{
  "EN" : {
    "CODE" : "EN",
    "ID1" : "en1",
    "ID2" : "en2"
  },
  "IT" : {
    "CODE" : "IT",
    "ID1" : "it1",
    "ID2" : "it2"
  },
  "FR" : {
    "CODE" : "FR",
    "ID1" : "fr1",
    "ID2" : "fr2"
  },
}
imtrobin commented 5 years ago

There are more rows than columns. It is for localization, each column is a country code, each row is an item to translate.

           EN(English)    IT(Italian)     FR (French)   etc

Item1 .. .. .. Item2 .. .. .. ItemX .. .. ..