private void ExportItems(ItemList list)
        {
            if (list.Items.Count > 0)
            {
                if (GUILayout.Button("Export Sheet"))
                {
                    string path = UtilScript.GetPath("Export_" + list.listName);

                    IWorkSheetDataWriter workSheetDataWriter = new ES3WorkSheetDataWriter();

                    string[][] sheetvals = new string[list.Items.Count][];
                    int        len       = list.Items.Count;
                    for (int i = 0; i < len; i++)
                    {
                        sheetvals[i] = list.Items[i].values.ToArray();
                    }

                    List <string> headings = new List <string>();
                    foreach (var heading in list.Headings)
                    {
                        headings.Add(heading.Name.GetVal());
                    }

                    workSheetDataWriter.WriteWorkSheetData(headings.ToArray(), sheetvals, System.IO.Directory.GetParent(path).FullName + "/" + list.listName)
                    .Subscribe(_ => Debug.Log("Export completed at path " + path));
                }
            }
        }
    private static ExcelQuery GetSheet()
    {
        Debug.Log("Get sheet");
        string sheetPath = UtilScript.GetPath("InventoryItem");

        if (!string.IsNullOrEmpty(sheetPath))
        {
            if (!File.Exists(sheetPath))
            {
                Debug.LogWarning(string.Format("Sheet Path {0} does not exist.", sheetPath));
            }
            else
            {
                return(new ExcelQuery(sheetPath));
            }
        }
        return(null);
    }
        private void GetColumnHeadings(ItemList list)
        {
            if (list.Headings.Count == 0 && list.listName != string.Empty)
            {
                if (GUILayout.Button("Get Column Headings"))
                {
                    string sheetPath = UtilScript.GetPath("InventoryItem");

                    if (!string.IsNullOrEmpty(sheetPath))
                    {
                        if (!File.Exists(sheetPath))
                        {
                            Debug.LogWarning(string.Format("Sheet Path {0} does not exist.", sheetPath));
                            return;
                        }

                        string guid = AssetDatabase.CreateFolder("Assets", list.listName);
                        string path = AssetDatabase.GUIDToAssetPath(guid);
                        guid = AssetDatabase.CreateFolder(path, "values");
                        string subPath = AssetDatabase.GUIDToAssetPath(guid);

                        ExcelQuery q = new ExcelQuery(sheetPath);
                        q.GetNewSheet(q.GetSheetNames()[0]);
                        string   err    = string.Empty;
                        string[] titles = q.GetTitle(0, ref err);
                        if (err != string.Empty)
                        {
                            Debug.LogError(string.Format("Could not read sheet titles from first sheet {0} of {1}", q.GetSheetNames()[0], sheetPath));
                            return;
                        }
                        else
                        {
                            int len = titles.Length;
                            for (int i = 0; i < len; i++)
                            {
                                StringDataValue name = Instantiate(list.NameValuePrefab);
                                name.name = "HeadingName_" + titles[i];
                                AssetDatabase.CreateAsset(name, subPath + "/" + name.name + ".asset");
                                IntDataValue index = Instantiate(list.IndexValuePrefab);
                                index.name = "HeadingIndex_" + titles[i];
                                AssetDatabase.CreateAsset(index, subPath + "/" + index.name + ".asset");

                                ColumnHeading newHeading = Instantiate(list.ColumnHeadingPrefab);
                                newHeading.name = "ColumnHeading_" + titles[i];
                                AssetDatabase.CreateAsset(newHeading, path + "/" + newHeading.name + ".asset");

                                newHeading.Name  = name;
                                newHeading.Index = index;

                                newHeading.Name.value  = titles[i];
                                newHeading.Index.value = i;

                                EditorUtility.SetDirty(newHeading);
                                EditorUtility.SetDirty(name);
                                EditorUtility.SetDirty(index);

                                list.Headings.Add(newHeading);
                            }
                        }
                    }
                    AssetDatabase.SaveAssets();
                    AssetDatabase.Refresh();
                }
            }
        }