/// <summary> /// Gets the data from an exact cell reference /// </summary> /// <param name="worksheet"></param> /// <param name="column"></param> /// <param name="row"></param> /// <returns></returns> public static CellData GetCellData(this GS2U_Worksheet worksheet, string column, int row) { int colInt = GoogleSheetsToUnityUtilities.GetIndexInAlphabet(column); CellEntry entry = worksheet.GetCellEntry(colInt, row); List <string> rows = worksheet.GetRowTitles(); List <string> cols = worksheet.GetColumnTitles(); CellData cellData = new CellData(entry.InputValue, rows[row - 1], cols[colInt - 1]); return(cellData); }
/// <summary> /// Deletes the first row found using nameID /// </summary> /// <param name="worksheet"></param> /// <param name="dataNameID"></param> public static void DeleteRowData(this GS2U_Worksheet worksheet, string dataNameID) { List <string> ids = worksheet.GetRowTitles(); int index = ids.IndexOf(dataNameID); if (index > -1) { worksheet.DeleteRowData(index); } else { Debug.Log("no data found for entry " + dataNameID); } }
/// <summary> /// updates a rows information based on the instance of dataname found in the worksheet /// </summary> /// <param name="worksheet"></param> /// <param name="dataNameID"> the current name in the spreedsheet using the first colum as the identifier</param> /// <param name="newData"></param> public static void ModifyRowData(this GS2U_Worksheet worksheet, string dataNameID, Dictionary <string, string> newData) { List <string> ids = worksheet.GetRowTitles(); int index = ids.IndexOf(dataNameID); if (index > -1) { worksheet.ModifyRowData(index, newData); } else { Debug.Log("no data found for entry " + dataNameID); } }