Synthoid/ExportSheetData

Export All Sheets as single json without sheet name

Closed this issue · 6 comments

Hi, like to request for feature. When I used "Export All Sheet", it will use the Sheet name as a json group. I like to combine all the sheets as a single json object.

e.g
https://docs.google.com/spreadsheets/d/1Y8CvCKoS4QoMt2P3XZsARmnuaIvDkzlcV8BuET5WlQo/edit#gid=0

This creates

{
  "Sheet1": {
    "test1": {      "X": 1,      "Y": 1,      "Z": 1    },
    "test2": {      "X": 2,      "Y": 2,      "Z": 2    },
    "test3": {      "X": 3,      "Y": 3,      "Z": 3    }
  },
  "Sheet2": {
    "test4": {      "X": 4,      "Y": 4,      "Z": 4    },
    "test5": {      "X": 5,      "Y": 5,      "Z": 5    },
    "test6": {      "X": 6,      "Y": 6,      "Z": 6    }
  }
}

I would want it like

{
  {
    "test1": {      "X": 1,      "Y": 1,      "Z": 1    },
    "test2": {      "X": 2,      "Y": 2,      "Z": 2    },
    "test3": {      "X": 3,      "Y": 3,      "Z": 3    },
    "test4": {      "X": 4,      "Y": 4,      "Z": 4    },
    "test5": {      "X": 5,      "Y": 5,      "Z": 5    },
    "test6": {      "X": 6,      "Y": 6,      "Z": 6    }
  }
}

I just added this functionality actually. You can use the Unwrap sheet prefix option to move a sheet's contents into the root of the exported JSON. With that option enabled, I exported two sheets called Sheet1 and Sheet2 as the following:

{
  "test1": {
    "X": 1,
    "Y": 1,
    "Z": 1
  },
  "test2": {
    "X": 2,
    "Y": 2,
    "Z": 2
  },
  "test3": {
    "X": 3,
    "Y": 3,
    "Z": 3
  },
  "test4": {
    "X": 4,
    "Y": 4,
    "Z": 4
  },
  "test5": {
    "X": 5,
    "Y": 5,
    "Z": 5
  },
  "test6": {
    "X": 6,
    "Y": 6,
    "Z": 6
  }
}

Does that seem to be what you were wanting?

Not quite, my sheets are named differently, so the prefix part won't work for me.

The names do not have to match for “Unwrap sheet prefix” to work. If you have two sheets named “US_Sheet01” and “US_Tab04”, both will be unwrapped and their contents will be placed in the root object.

I know. I have about 50 sheets to match, I prefer not to change the sheet prefix. Is it able to do without the prefix?

The only option that can unwrap all sheet tabs currently is Unwrap single row sheets. If all of your sheet tabs only contain one row (excluding keys) then that will work, otherwise you will have to apply the prefix to each tab.

I can see how it may be good to have an option to unwrap all sheets, similar to how the Export sheet arrays and Array prefix options work for JSON. For now though, you'll have to use the prefix method to unwrap your sheets. Sorry for the inconvenience!

ok thanks