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

null instead of "null" #94

Closed flutter-painter closed 4 years ago

flutter-painter commented 4 years ago

This repo is amazing, thank you so much for building this, Please could you tell me how we can have null without coma, The same way that true is exported :

This is what I get : "dlc": "null", "quantity": 0, "isDefault": true

This is what we need : "dlc": null, "quantity": 0, "isDefault": true

flutter-painter commented 4 years ago

/src/ExportSheetData.gs

l319 else if(cellArray[i] === 'true') cellArray[i] = true; l320 else if(cellArray[i] === 'false') cellArray[i] = false;

does it solve it if we add : l321 else if(cellArray[i] === 'null') cellArray[i] = null;

Synthoid commented 4 years ago

Currently, any values entered into cells are interpreted as-is. A cell with the value null entered is interpreted as the string "null" because as far the cell is concerned, there is a string value inside it. You can leave the field empty and set the empty value format to null values to do what you want. It may be good to allow users to enter null to create a null value though.

flutter-painter commented 4 years ago

Thank you for the quick reply, Problem is I need to use the "ignore empty cell", So the empty value format cannot be used,

It would be good to allow users, including myself, to enter null This project is already a life-saver for our us, If there is anything I can do, blog publicity, testimony, please let me know by PM

Synthoid commented 4 years ago

Sorry for the delayed response. I think I can add a feature similar to the bool checks where null is translated as a null value, while "null" is translated as the string null. I'll mess around with it and try to get something posted next week.

flutter-painter commented 4 years ago

Amazing, thanks a lot !

Synthoid commented 4 years ago

Sorry it took longer than expected, but this is available as of v57.

flutter-painter commented 4 years ago

Well done, I owe you a bif coffee ;)