private static Dictionary<string, CellEntry> CreateEntryCellsMap(SpreadsheetsService service, CellFeed cellFeed, List<ExcelCell> cells) { Dictionary<string, CellEntry> res = new Dictionary<string, CellEntry>(); CellFeed batchRequest = new CellFeed(new Uri(cellFeed.Self), service); foreach (ExcelCell cell in cells) { if (cell.GetEntry() == null) { CellEntry batchEntry = new CellEntry(cell.Row, cell.Column, cell.GetBatchID()); batchEntry.Id = new AtomId(string.Format("{0}/{1}", cellFeed.Self, cell.GetBatchID())); batchEntry.BatchData = new GDataBatchEntryData(cell.GetBatchID(), GDataBatchOperationType.query); batchRequest.Entries.Add(batchEntry); } else { if (!res.ContainsKey(cell.GetBatchID())) { res.Add(cell.GetBatchID(), cell.GetEntry()); } } } if (batchRequest.Entries.Count > 0) { CellFeed queryBatchResponse = (CellFeed) service.Batch(batchRequest, new Uri(cellFeed.Batch)); foreach (CellEntry entry in queryBatchResponse.Entries) { res.Add(entry.BatchData.Id, entry); } } return res; }
public CellEntry this[uint row, uint column] { get { // let's find the cell foreach (CellEntry entry in this.Entries) { CellEntry.CellElement cell = entry.Cell; if (cell.Row == row && cell.Column == column) { return(entry); } } // if we are here, we need to get the entry from the service string url = CellUri(row, column); CellQuery query = new CellQuery(url); CellFeed feed = this.Service.Query(query) as CellFeed; CellEntry newEntry = feed.Entries[0] as CellEntry; this.Entries.Add(newEntry); // we don't want this one to show up in the batch feed on it's own newEntry.Dirty = false; return(newEntry); } }
public void Parse() { Title = _entry.Title.Text; CellQuery cellQuery = new CellQuery(_entry.CellFeedLink); CellFeed cellFeed = _service.Query(cellQuery); _cellFeed = cellFeed; Dictionary<uint, List<CellEntry>> groupRows = new Dictionary<uint, List<CellEntry>>(); foreach (CellEntry cell in cellFeed.Entries) { if (!groupRows.ContainsKey(cell.Row)) { groupRows[cell.Row] = new List<CellEntry>(); } groupRows[cell.Row].Add(cell); } string category = ""; foreach (KeyValuePair<uint, List<CellEntry>> row in groupRows) { ExcelRow excelRow = new ExcelRow(this,row.Key, row.Value); Rows.Add(excelRow); excelRow.Parse(ref category); } foreach (ExcelRow excelRow in Rows) { if (!string.IsNullOrEmpty(excelRow.OriginalCategory)) { excelRow.Category = ExcelRow.GetNewCategory(excelRow.OriginalCategory, excelRow.Name); } } }
private List<string> GetNodeMatches(CellFeed cellFeed, string lookupText) { List<string> listNodes = new List<string>(); for (int i = 0; i < cellFeed.Entries.Count; i = i + 2) { CellEntry curCell = (CellEntry)cellFeed.Entries[i]; string urlText = curCell.Value; if (!string.IsNullOrWhiteSpace(urlText) && urlText.Contains(lookupText)) { CellEntry nextCell = (CellEntry)cellFeed.Entries[i + 1]; listNodes.Add(nextCell.Value); break; } } return listNodes; }
private void ExportDatablocks(Type datablockType) { var worksheet = (WorksheetEntry) spreadsheet.Worksheets.Entries[0]; IEnumerable<Datablock> datablocks = DatablockManager.Instance.GetDatablocks(datablockType); datablockFields = Datablock.GetFields(datablockType); List<string> headers = datablockFields.Select(f => f.Name).ToList(); headers.Insert(0, "Parent"); headers.Insert(0, "Name"); // Set the worksheet to a single row for our headers worksheet.Cols = (uint) headers.Count; worksheet.Rows = (exportData ? (uint) datablocks.Count() : 0) + 1; worksheet.Update(); if (exportData) { // Fetch the cell feed of the worksheet. var cellQuery = new CellQuery(worksheet.CellFeedLink); cellQuery.ReturnEmpty = ReturnEmptyCells.yes; cellFeed = sheetsAPI.Service.Query(cellQuery); batchRequest = new CellFeed(cellQuery.Uri, sheetsAPI.Service); currentCellIndex = 0; // Set headers for (int index = 0; index < headers.Count; index++) { string cellValue = headers[index]; SetNextCellValue(cellValue); } currentCellIndex = headers.Count; IEnumerable<Datablock> baseDatablocks = datablocks.Where(d => d.Parent == null); // Process the datablocks from the base to their children foreach (Datablock baseDatablock in baseDatablocks) { ProcessChildren(baseDatablock); } sheetsAPI.Service.Batch(batchRequest, new Uri(cellFeed.Batch)); } Debug.Log("Datablocks saved to " + spreadsheet.Title.Text); }
private static bool RequestUpdateCells(List<ExcelCell> cells) { bool res = true; if (cells.Count > 0) { ExcelTable excelTable = cells[0].GetRow().GetTable(); CellFeed cellFeed = excelTable.GetCellFeed(); CellQuery cellQuery = new CellQuery(excelTable.GetEntry().CellFeedLink); Dictionary<string, CellEntry> cellEntries = CreateEntryCellsMap(ExcelManager.Inst.SpreadsheetsService, cellFeed, cells); CellFeed batchRequest = new CellFeed(cellQuery.Uri, ExcelManager.Inst.SpreadsheetsService); foreach (ExcelCell cell in cells) { CellEntry batchEntry = cellEntries[cell.GetBatchID()]; string inputValue = ""; if (cell.EditTmpValue > 0) { inputValue = cell.EditTmpValue.ToString().Replace(".", ","); } batchEntry.InputValue = inputValue; batchEntry.BatchData = new GDataBatchEntryData(cell.GetBatchID(), GDataBatchOperationType.update); batchRequest.Entries.Add(batchEntry); } // Submit the update CellFeed batchResponse = (CellFeed) ExcelManager.Inst.SpreadsheetsService.Batch(batchRequest, new Uri(cellFeed.Batch)); foreach (CellEntry entry in batchResponse.Entries) { string batchId = entry.BatchData.Id; if (entry.BatchData.Status.Code != 200) { res = false; GDataBatchStatus status = entry.BatchData.Status; Console.WriteLine("{0} failed ({1})", batchId, status.Reason); } else { ExcelCell cell = ExcelRow.GetCellByBatchId(cells, batchId); Debug.Assert(null != cell); cell.Value = cell.EditTmpValue; cell.SetEntry(entry); } } } return res; }
public uint getLanguageRow(string fileName, CellFeed languages) { foreach (CellEntry entry in languages.Entries) { if (fileName.Contains(entry.Content.Content + ".")) { return entry.Row; } } return 0; }
// Clears each cell's inputValue public void clearCellFeed(CellFeed feed) { foreach (CellEntry cell in feed.Entries) { cell.InputValue = ""; cell.Update(); } }
/// <summary> /// Get cells in the given <paramref name="worksheet" />. /// </summary> /// <param name="worksheet">The <typeparamref name="Google.GData.Spreadsheets.WorksheetEntry" /> from which the wcells should be returned.</param> /// <returns>Returns a <typeparamref name="Google.GData.Spreadsheets.CellEntry" /> array.</returns> public virtual CellEntry[] GetCells(WorksheetEntry worksheet) { if (worksheet == null) { worksheet = GetWorksheets(null)[0]; } var query = new CellQuery(worksheet.CellFeedLink); query.ReturnEmpty = ReturnEmptyCells.yes; this.cellFeed = this.service.Query(query); var result = new CellEntry[this.cellFeed.Entries.Count]; this.cellFeed.Entries.CopyTo(result, 0); return result; }
/// <summary> /// Updates multiple cells in the given worksheet. /// </summary> /// <param name="worksheet">The <typeparamref name="Google.GData.Spreadsheets.WorksheetEntry" /> in which the cells should be updated.</param> /// <param name="cellEntries">A list of cellEntries, which contains updated values.</param> /// <exception cref="System.ArgumentNullException"><paramref name="worksheet"/> is null.</exception> /// <exception cref="System.ArgumentOutOfRangeException"><paramref name="cellEntries"/> contains 0 elements.</exception> /// <exception cref="System.NullReferenceException">this.cellFeed is null - that means GetCells() was never called.</exception> public virtual void UpdateCells(WorksheetEntry worksheet, IList<CellEntry> cellEntries) { // Catch some no-go's. if (worksheet == null) { throw new ArgumentNullException("worksheet"); } if (cellEntries.Count == 0) { throw new ArgumentOutOfRangeException("cellEntries.Count"); } if (cellEntries.Count == 1) { UpdateCell(cellEntries[0], cellEntries[0].InputValue); return; } if (this.cellFeed == null) { throw new NullReferenceException(); } // Set up the batch request. var batchRequest = new CellFeed(new CellQuery(worksheet.CellFeedLink).Uri, this.service); foreach (var batchEntry in cellEntries) { batchEntry.BatchData = new GDataBatchEntryData(GDataBatchOperationType.update); batchRequest.Entries.Add(batchEntry); } // Submit it. var batchResponse = (CellFeed) this.service.Batch(batchRequest, new Uri(this.cellFeed.Batch)); // Some debug code #if DEBUG foreach (CellEntry entry in batchResponse.Entries) { System.Diagnostics.Debug.WriteLineIf(entry.BatchData.Status.Code != 200, entry.BatchData.Id + " failed: " + entry.BatchData.Status.Reason); } #endif }
/// <summary> /// Get cells in the given <paramref name="worksheet" />. /// </summary> /// <param name="query">The <typeparamref name="Google.GData.Spreadsheets.CellQuery" /> which should be executed.</param> /// <returns>Returns a <typeparamref name="Google.GData.Spreadsheets.CellEntry" /> array.</returns> /// <exception cref="System.ArgumentNullException"><paramref name="query"/> is null.</exception> public virtual CellEntry[] GetCells(CellQuery query) { if (query == null) { throw new ArgumentNullException("query"); } this.cellFeed = this.service.Query(query); var result = new CellEntry[this.cellFeed.Entries.Count]; this.cellFeed.Entries.CopyTo(result, 0); return result; }
/// <summary> /// Updates the online spreadsheet according the maps file /// </summary> /// public static void SheetSync(bool ForceSync) { Bot.SteamFriends.SetPersonaName("[" + ImpMaster.Maplist.Count.ToString() + "] " + Bot.DisplayName); if ((GroupChatHandler.OnlineSync.StartsWith("true", StringComparison.OrdinalIgnoreCase) && !SyncRunning) || ForceSync) { SyncRunning = true; //Log.Interface ("Beginning Sync"); OAuth2Parameters parameters = new OAuth2Parameters(); parameters.ClientId = GroupChatHandler.CLIENT_ID; parameters.ClientSecret = GroupChatHandler.CLIENT_SECRET; parameters.RedirectUri = GroupChatHandler.REDIRECT_URI; parameters.Scope = GroupChatHandler.SCOPE; parameters.AccessType = "offline"; parameters.RefreshToken = GroupChatHandler.GoogleAPI; OAuthUtil.RefreshAccessToken(parameters); string accessToken = parameters.AccessToken; GOAuth2RequestFactory requestFactory = new GOAuth2RequestFactory(null, GroupChatHandler.IntegrationName, parameters); SpreadsheetsService service = new SpreadsheetsService(GroupChatHandler.IntegrationName); service.RequestFactory = requestFactory; SpreadsheetQuery query = new SpreadsheetQuery(SpreadSheetURI); SpreadsheetFeed feed = service.Query(query); SpreadsheetEntry spreadsheet = (SpreadsheetEntry)feed.Entries[0]; WorksheetFeed wsFeed = spreadsheet.Worksheets; WorksheetEntry worksheet = (WorksheetEntry)wsFeed.Entries[0]; worksheet.Cols = 5; worksheet.Rows = Convert.ToUInt32(ImpMaster.Maplist.Count + 1); worksheet.Update(); CellQuery cellQuery = new CellQuery(worksheet.CellFeedLink); cellQuery.ReturnEmpty = ReturnEmptyCells.yes; CellFeed cellFeed = service.Query(cellQuery); CellFeed batchRequest = new CellFeed(cellQuery.Uri, service); int Entries = 1; foreach (var item in ImpMaster.Maplist) { Entries = Entries + 1; foreach (CellEntry cell in cellFeed.Entries) { if (cell.Title.Text == "A" + Entries.ToString()) { cell.InputValue = item.Key; } if (cell.Title.Text == "B" + Entries.ToString()) { cell.InputValue = item.Value.Item1; } if (cell.Title.Text == "C" + Entries.ToString()) { cell.InputValue = item.Value.Item2.ToString(); } if (cell.Title.Text == "D" + Entries.ToString()) { cell.InputValue = item.Value.Item3.ToString(); } if (cell.Title.Text == "E" + Entries.ToString()) { cell.InputValue = item.Value.Item4.ToString(); } } } cellFeed.Publish(); CellFeed batchResponse = (CellFeed)service.Batch(batchRequest, new Uri(cellFeed.Batch)); // Log.Interface("Completed Sync"); SyncRunning = false; } else if (GroupChatHandler.OnlineSync.StartsWith("true", StringComparison.OrdinalIgnoreCase)) { GroupChatHandler.SpreadsheetSync = true; } }
public void logItConference(string fileName, string result) { try { this.canClose = false; WorksheetEntry worksheet = null; CellFeed cells = null; // FIND THE SPREADSHEET AND WORKSHEET SpreadsheetQuery query = new SpreadsheetQuery(); this.allSheets = this.service.Query(query); String lastCode = ""; this.currentSpreadSheet = new SpreadsheetEntry(); string s = fileName; string code = this.getCode(s); if (code == "NO FILE CODE FOUND") { return; } string spreadsheetCode = spreadsheets[code]; if (lastCode != this.getFullCode(s)) { lastCode = this.getFullCode(s); for (int i = 0; i < this.allSheets.Entries.Count; i++) { if (this.allSheets.Entries[i].AlternateUri.Content.Contains(spreadsheetCode)) { this.currentSpreadSheet = (SpreadsheetEntry)this.allSheets.Entries[i]; WorksheetFeed wsFeed = this.currentSpreadSheet.Worksheets; for (int x = 0; x < wsFeed.Entries.Count; x++) { WorksheetEntry wksht = (WorksheetEntry)wsFeed.Entries[x]; worksheet = wksht; CellQuery Querycells = new CellQuery(wksht.CellFeedLink); Querycells.MaximumColumn = 1; Querycells.MaximumRow = 2; Querycells.MinimumColumn = 1; Querycells.MinimumRow = 2; this.cells = this.service.Query(Querycells); string fix = System.IO.Path.GetFileName(s); if (fix.Contains(this.cells.Entries[0].Content.Content)) { this.currentWorkSheet = wksht; break; } } } } // NOW, if all went well, we are in the right sheet. Create the list of the needed things-- //List of languages CellQuery languageQuery = new CellQuery(this.currentWorkSheet.CellFeedLink); languageQuery.MinimumRow = 3; languageQuery.MaximumColumn = 2; languageQuery.MinimumColumn = 2; languageQuery.ReturnEmpty = ReturnEmptyCells.no; CellFeed languages = this.service.Query(languageQuery); //OVP tabs CellQuery OVPTabs = new CellQuery(this.currentWorkSheet.CellFeedLink); OVPTabs.MinimumRow = OVPTabs.MaximumRow = 1; CellFeed columnHeadings = this.service.Query(OVPTabs); //USE THIS TO FIND EACH INDIVIDUAL VIDEO'S COLUMN uint row = this.getLanguageRow(s, languages); uint col = this.getEditColumn(s, columnHeadings, "QC", this.currentWorkSheet); //OVP tabs //USE THIS TO FIND EACH INDIVIDUAL VIDEO'S COLUMN if (col == 0 || row == 0) { // something failed--write to the google doc to say that it failed return; } //Get Individual Cell CellQuery edit = new CellQuery(this.currentWorkSheet.CellFeedLink); edit.MaximumRow = edit.MinimumRow = row; edit.MaximumColumn = edit.MinimumColumn = col; edit.ReturnEmpty = ReturnEmptyCells.yes; CellFeed editCell = this.service.Query(edit); CellEntry temp = (CellEntry)editCell.Entries[0]; if (this.initials == "") { temp.InputValue = ""; } else { temp.InputValue = result; } temp.Update(); this.canClose = true; } } catch (Exception exeption) { logger.writeErrorLog("Failed to log " + fileName + " in conference google docs " + DateTime.Now); this.canClose = true; } this.canClose = true; }
public uint getFileNameRow(string fileName, CellFeed fileNames) { string target = fileName.Split('_')[0]; foreach (CellEntry entry in fileNames.Entries) { if (entry.Content.Content.Contains(target)) { return entry.Row; } } return 0; }
public int doesCellFeedContainString(CellFeed feed, string target) { foreach(CellEntry cell in feed.Entries) { if (cell.InputValue.Contains(target)) { return (int)cell.Row; } } return -1; }
private uint getEditColumn(string s, CellFeed columnHeadings, string header, WorksheetEntry currentWorksheet) { string content; // find header int headerColumn = 0; foreach (CellEntry entry in columnHeadings.Entries) { content = entry.Content.Content.ToLower(); if (content.Equals(header.ToLower())) { headerColumn = (int)entry.Column; } } if (headerColumn != 0) { CellQuery findCol = new CellQuery(currentWorkSheet.CellFeedLink); findCol.MaximumRow = findCol.MinimumRow = 2; findCol.MinimumColumn = (uint)headerColumn; CellFeed possibleColumns = this.service.Query(findCol); string text; if (header.Contains("OVP") || header.Contains("QC")) { text = this.getBitRateText(s); } else { text = this.getTechnicalText(s); } foreach (CellEntry entry in possibleColumns.Entries) { content = entry.Content.Content.ToLower(); if (content.Contains(text.ToLower())) { return (uint)entry.Column; } } } else { return 0; } return 0; }
/// <summary> /// Sets the list view on the Cells tab /// </summary> /// <param name="feed">The feed providing the data</param> void SetCellListView(CellFeed feed) { // Clear out all the old information this.cellsListView.Items.Clear(); this.cellsListView.Columns.Clear(); this.editUriTable.Clear(); AtomEntryCollection entries = feed.Entries; // Add in the column headers, as many as the column count asks // The number of rows, we only care to go as far as the data goes this.cellsListView.Columns.Add("", 20, HorizontalAlignment.Left); for (int i=1; i < feed.ColCount.Count; i++) { this.cellsListView.Columns.Add(i.ToString(), 80, HorizontalAlignment.Center); } int currentRow = 1; int currentCol = 1; ListViewItem item = new ListViewItem(); item.Text = 1.ToString(); for (int i=0; i < entries.Count; i++) { CellEntry entry = entries[i] as CellEntry; if (entry != null) { // Add the current row, since we are starting // a new row in data from the feed while (entry.Cell.Row > currentRow) { this.cellsListView.Items.Add(item); item = new ListViewItem(); item.Text = (currentRow + 1).ToString(); currentRow++; currentCol = 1; } // Add blank entries where there is no data for the column while (entry.Cell.Column > currentCol) { item.SubItems.Add(""); currentCol++; } // Add the current data entry item.SubItems.Add(entry.Cell.Value); this.editUriTable.Add("R" + currentRow + "C" + currentCol, entry); currentCol++; } } }
private void writeJob(string siteName, int count, uint index, CellFeed cellFeed) { Random rand = new Random(); siteName += " " + new String('I', rand.Next(2) + 1); string description = this.partNames[rand.Next(partNames.Count - 1)] + " " + this.repairActivities[rand.Next(repairActivities.Count - 1)]; cellFeed.Insert(new CellEntry(index + 2, 1, "JOB" + index.ToString("0000#"))); cellFeed.Insert(new CellEntry(index + 2, 2, description)); cellFeed.Insert(new CellEntry(index + 2, 3, siteName)); }
private void writeJobsToGoogleDocs(CellFeed cellFeed) { Random rand = new Random(); List<String> names = Enumerable.ToList<String>(this.siteNames.Keys); int nameCount = this.siteNames.Count; for (int i = 0; i < 40; i++) { string randName = names[rand.Next(nameCount)]; int count = this.siteNames[randName]; this.writeJob(randName, count, (uint)i, cellFeed); this.siteNames[randName] += 1; this.writeToGoogleWorker.ReportProgress(i * 100 / 40); } }
protected override void SolveInstance(IGH_DataAccess DA) { //declare input variables to load into AuthToken authToken = new AuthToken(); string sheetName = ""; string worksheet = ""; bool rowsColumns = false; GH_Structure<GH_String> addresses = new GH_Structure<GH_String>(); GH_Structure<GH_String> data = new GH_Structure<GH_String>(); bool write = false; //declare output variables GH_Structure<GH_String> addressesOut = new GH_Structure<GH_String>(); //get data from inputs if (!DA.GetData<AuthToken>("Token", ref authToken)) { return; //exit if no token given } if (!authToken.IsValid) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "The provided authentication token appears to be invalid. Try re-running the Google Authenticator component."); return; //exit if token invalid } if (!DA.GetData<string>("Name", ref sheetName)) { return; //exit if no name given } DA.GetData<string>("Worksheet", ref worksheet); DA.GetData<bool>("Organize by Rows or Columns", ref rowsColumns); DA.GetDataTree<GH_String>("Address", out addresses); DA.GetDataTree<GH_String>("Data", out data); DA.GetData<bool>("Write", ref write); if (!write) return; //exit if write is not true //check each specified address for validity foreach (GH_String address in addresses.AllData(true)) { if (!GDriveUtil.isValidAddress(address.ToString())) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error,"Not all addresses are specified in a valid format."); return; } } //setup auth and factory //set up oAuth parameters OAuth2Parameters parameters = GDriveUtil.GetParameters(authToken); SpreadsheetsService service = GDriveUtil.GetSpreadsheetsService(parameters); //find spreadsheet by name SpreadsheetEntry spreadsheet = GDriveUtil.findSpreadsheetByName(sheetName, service); if (spreadsheet == null) //if the spreadsheet is not found { if (createNewSpreadsheets) //if the user has elected to create new spreadsheets { List<string> worksheets = new List<string>(); if (!String.IsNullOrEmpty(worksheet)) { worksheets.Add(worksheet); //create a 1-item list with the worksheet name } spreadsheet = CreateSpreadsheet.createNewSpreadsheet(this, authToken, sheetName, worksheets, false); //create the spreadsheet } else { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Specified spreadsheet not found."); return; } } //find worksheet by name WorksheetEntry worksheetEntry = GDriveUtil.findWorksheetByName(worksheet, spreadsheet); if (worksheetEntry == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Specified worksheet not found."); return; } uint maxRow = 0; uint maxCol = 0; // set up dictionary<Cell address, cell input> // associate each input value with a corresponding address Dictionary<string, string> writeMap = constructWriteMap(addresses, data, rowsColumns, ref maxRow, ref maxCol, ref addressesOut); //expand worksheet if necessary if (worksheetEntry.Rows < maxRow) { worksheetEntry.Rows = maxRow; worksheetEntry.Etag = "*"; //required for compatibility with "new" google sheets (see: http://stackoverflow.com/questions/22719170/updating-cell-in-google-spreadsheets-returns-error-missing-resource-version-id) worksheetEntry.Update(); } if (worksheetEntry.Cols < maxCol) { worksheetEntry.Cols = maxCol; worksheetEntry.Etag = "*"; //required for compatibility with "new" google sheets (see: http://stackoverflow.com/questions/22719170/updating-cell-in-google-spreadsheets-returns-error-missing-resource-version-id) worksheetEntry.Update(); } //set bounds of cell query CellQuery cellQuery = new CellQuery(worksheetEntry.CellFeedLink); cellQuery.MinimumColumn = 0; cellQuery.MinimumRow = 0; cellQuery.MaximumColumn = maxCol; cellQuery.MaximumRow = maxRow; cellQuery.ReturnEmpty = ReturnEmptyCells.yes; //retrieve cellfeed CellFeed cellFeed = service.Query(cellQuery); //convert cell entries to dictionary Dictionary<string,AtomEntry> cellDict = cellFeed.Entries.ToDictionary(k => k.Title.Text); CellFeed batchRequest = new CellFeed(cellQuery.Uri, service); //set up batchrequest foreach (KeyValuePair<string, string> entry in writeMap) { AtomEntry atomEntry; cellDict.TryGetValue(entry.Key, out atomEntry); CellEntry batchEntry = atomEntry as CellEntry; batchEntry.InputValue = entry.Value; batchEntry.Etag = "*"; //required for compatibility with "new" google sheets (see: http://stackoverflow.com/questions/22719170/updating-cell-in-google-spreadsheets-returns-error-missing-resource-version-id) batchEntry.BatchData = new GDataBatchEntryData(GDataBatchOperationType.update); batchRequest.Entries.Add(batchEntry); } CellFeed batchResponse = (CellFeed)service.Batch(batchRequest, new Uri(cellFeed.Batch)); // Check the results bool isSuccess = true; foreach (CellEntry entry in batchResponse.Entries) { string batchId = entry.BatchData.Id; if (entry.BatchData.Status.Code != 200) { isSuccess = false; GDataBatchStatus status = entry.BatchData.Status; } } if (!isSuccess) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Update operations failed"); } //output addresses DA.SetDataTree(0, addressesOut); //write addressesOut to first output parameter }