Coder Social home page Coder Social logo

cathei / bakingsheet Goto Github PK

View Code? Open in Web Editor NEW
327.0 7.0 31.0 8.2 MB

Easy datasheet management for C# and Unity. Supports Excel, Google Sheet, JSON and CSV format.

License: MIT License

C# 99.82% Makefile 0.10% PowerShell 0.09%
excel unity3d google-sheets csharp-library spreadsheet nuget-package csv json datasheet csharp

bakingsheet's Introduction

Hello, I'm Maxwell Keonwoo Kang πŸ‘‹

I'm a game developer and a open source contributer.

Born in πŸ‡°πŸ‡· South Korea, living in πŸ‡ΊπŸ‡Έ USA.

GitHub stats

Open source projects 🌟

BakingSheet Card

🍞 BakingSheet is C# Spreadsheet converting tool, works for .NET and Unity.

LinqGen Card

⚑ LinqGen is Zero-allocation Linq-to-object implementation with Roslyn source generator.

PinInject Card

πŸ“Œ PinInject is Dependency injection plugin for Unity game engine.

Schema Card

πŸ’¬ Svelto.ECS.Schema is extension for Svelto.ECS, to define entity groups as schema and fluently query from them.

Incremental Card

πŸ“ˆ Incremental is deterministic decimal data type in C# with huge representation range for idle games.

bakingsheet's People

Contributors

cathei avatar omega-ult avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

bakingsheet's Issues

Transpose Sheet Row and Column on import

I have a large list of settings (with variations for different builds) I'm importing from a Google Sheet but at the moment I don't see an easy way of transposing the data at the BakingSheet end so that the 'rows' of data are laid out horizontally and the 'columns' are on the left hand side, vertically.

I think a property in the Sheet definition would be required ie bool importTransposed = true

And then maybe just adding a toggle in the GetCell to reverse the SheetConverter - thing is that currently doesn't have access to the Sheet definition. Also the record/row count would be wrong as the last empty column should be used rather than the row.

Anyway - a feature suggestion as it came to mind really.

Currently possible to transpose in the Google Sheet using reference formula cells in the Google Sheet, hide the Import Sheet and only work on the referenced sheet - so it's not vital or anything. Or manually before import etc.

Incorrect Excel parsing when system decimal separator is a comma

If the system is configured to use decimal separator different from a dot (.), Excel converter parses floats incorrectly.

Source Excel:
image

Converted JSON:
image

I narrowed this down to a ToString call in ExcelSheetConverter.Page.GetCell:

Debugger console:
  _table.Rows[row][col]
  0.29999999999999999

  _table.Rows[row][col].ToString()
  "0,3"

I fixed it like this. Don't know if that's the only place to fix though.

public string GetCell(int col, int row)
{
	if (col >= _table.Columns.Count || row >= _table.Rows.Count)
		return null;
	
	if (_table.Rows[row][col] is IConvertible conv)
		return conv.ToString(CultureInfo.InvariantCulture);
	else
		return _table.Rows[row][col].ToString();
}

My regional settings for reference:
image

Support partial sheet

Support partial sheet across multiple spreadsheet files. To be consistent, optional sheet subtitle convention Name.Subname may be supported as well. Subname is metadata and should be unique for same name if used.

Additional thoughts

  • Most Spreadsheet tools do not support page with same name in one file, subname can be a remedy.
  • The ordering can be preserved by sorting subnames. If no subname provided then order cannot be guaranteed.
  • Partial sheets can have different combination of columns as long as they are defined.
  • Row id in all partial sheets with same name must be unique.

Consideration about link.xml

AOT code stripping could affect reflection. BakingSheet has been deployed link.xml with .unitypackage.

But this needs to be tested again since we moved to embedded package. Also, Unity does not support link.xml from pacakge.

At least I can say that when user trying to ship a mobile build with Google converter, they'll need link.xml.

Unity documentation

Support C# 9 Record Type

This will be interesting and well match with concept of BakingSheet

However there will be some complication like compatibility with Unity, version check, IsExternalInit issue, etc.

Add support for nested vertical list in other vertical list or dictionary

It is common in game developement to have nested vertical list to ease the workflow of game designers.

For example, an seasonal event CSV can have multiple packages, each package contains multiple rewards, and each reward can be a single item or multiple items. Splitting this kind of data into multiple CSV sheets would make it hard for the designer to track and compare their balancing between those data packages.

I wonder if it requires too much work to support nested vertical lists?

It's hard to promote the use of BakingSheet in my company. Currently I'm the only one use BakingSheet. But atm the game is in alpha stage and doesn't have complex data types. But every single product of my company will eventually need this kind of data at some point in the game's lifetime.

Built-in Addressable Assets Verifier

We could use versionDefines of asmdef to make it only enabled when Addressable Assets package is included

Until this get included, user can define their own.

Can't make it work in WebGL builds

Hello! I tried to use this in the WebGL target with and without the BetterStreamingAssets package and I can't make it work.

I think it is probably because StreamingAssets in web need to be loaded using UnityWebRequest but I don't understand how to use that with the included Converters.

Is there a converter that I can just feed the string containing my csv and it just works? πŸ€”


Some more info: I don't see any network request to download the assets, The error I am getting is
Failed to find sheet: Constants when trying to run the line Debug.Log(Sheet.Constants.Count);

Add optional Script Defining Symbols for Google and CSV converter

Giving option to define a symbol to include Google and CSV converter on runtime.

BakingSheet has distributed as embedded package because this reason.
As intended modification can be done with script defining symbol instead, BakingSheet will be distributed with git or OpenUPM only.

Notion Converter

Just dropping this feature idea. Notion DB to Unity via BakingSheet converter.

I've mentioned this BakingSheet project to the author of CarterGames/NotionToUnity#1
Seems to be very closely related. There are other test projects on GiHub with same concept but this one seems most recent and developed.

RawSheetImporter's ImportRow should wrap page.GetCell in the try block

I was implementing my own RawSheetImporter and ran into an issue where only about half of the pages in the sheet were being loaded. It turns out that GetCell() was throwing but because it's wrapped in a Task called from an Async MenuItem, nothing actually caught the exception.

I think the GetCell call in ImportRow should be part of the same try/catch that propertyMap.SetValue() is.

com.unity.nuget.newtonsoft-json 3.0.2/Newtonsoft.Json 13.0.1 causing dependency version mismatch when importing .unitypackage

Hello,

Thanks for developing this awesome package πŸ˜„ Unity installs the 3.0.2 version of their JSON package, which uses Newtonsoft.Json 13.0.1, even though this package depends on the 2.0 one. I imagine this is because we're using 2021 LTS, mainly for its new features and improved Android stability.

I am unable to rollback to the previous version and it seems this was an informed decision on Unity's side.. It seems you can manually install 2.0.0 from Package Manager > Add package by name, or edit Packages/manifest.json manually on Unity versions that don't have that option. However, this might be an issue for people who use Unity's Version Control package as it depends on Unity's Newtonsoft Json package. Unity isn't good at dealing with different versions of the same package coexisting.

I managed to get rid of the errors by upgrading all the Google.Apis.* packages to their latest version while using the 3.0.2 version. As for future releases, I can think of several solutions but I'm unsure which one would be the best course of action.

  1. Upgrade com.unity.nuget.newtonsoft-json dependency from 2.0 to 3.0
  2. Keep the old version but add a reminder to the readme that you have to install the 2.0.0 version if Unity installs 3.0+ manually. Also maybe explain that you need to download the latest versions of the DLLs yourself for 3.0 support.
  3. Release multiple versions of the .unitypackage, one supporting com.unity.nuget.newtonsoft-json 2.0 and the other 3.0

I feel like the first option makes the most sense, as the 2.0 docs says it's meant for internal development but the 3.0 docs don't, but I'd love to hear your opinion on it too.

Make SheetContainerBase overridable, extendable

I'm working on a custom Editor tooling that depends on BakingSheet for intermediate steps. But I've found myself in need of overidding SheetContainerBase to support IProgress<float> in the async Bake and Store methods.

Could you make at least Bake and Store methods virtual to enable this use case?

One possible solution for better extending is extracting an ISheetContainer interface out of SheetContainerBase, and making SheetConvertingContext use this interface instead of the abstract class.

With either solutions, people can freely provide their own custom implementation of SheetContainerBase without the need of modifying your source code.

Suggestions for clarifying setup instructions

Hi thanks for the asset, got it working after a (lot) of confusion. Main issue for me was the terminology... I was connecting to Google Sheets so 'Sheets' was used everywhere... it was not working for a long time until I finally spotted this:

"You can see there are two classes, ItemSheet and ItemSheet.Row. Each represents a page of sheet and a single row. ItemSheet is surrounding Row class (It is not forced but recommended convention). Important part is they will inherit from Sheet and SheetRow."

So in Google Sheets, the document is considered a Sheet, and then you can add Sheets to the Sheet.... !

The Page vs Sheet issue got me for a long time and it wasn't too clear even looking at the code.
Highlighting this comment would also help.

// property name matches with corresponding sheet name
// for .xlsx or google sheet, **it is name of the sheet tab in the workbook**
// for .csv or .json, it is name of the file
public ItemSheet Items { get; private set; }

Another issue that got me was the sample Items... so when I referenced the container.Items it looked a lot like a List item .... not a SheetPage.Rows. Finally figured it was container.SheetPage.Row.

So maybe changing the example from Items to anything else like Spells or Animals etc would make it clearer as to the abstract class language and the model language.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.