Ich habe ein C# -Programm, mit dem Werte in meinem Google -Blatt hinzufügen und bearbeiten und entfernen können. Aber ich kann die Datensätze in der Tabelle nicht richtig sortieren. Hier ist mein Code: < /p>
public bool SortGoogleSheet(
int i_sorted_column_index,
int i_start_row_index,
int i_end_row_index,
int i_start_col_index,
int i_end_col_index,
string str_sort_direction,
ref bool b_error_occurred)
{
Program.LogIt("Begin SortGoogleSheet()");
string sheetname = "Items";
int i_sheet_id = GetSheetId(_sheetsService, _spreadsheetId, sheetname);
BatchUpdateSpreadsheetRequest busReq = new BatchUpdateSpreadsheetRequest();
SortRangeRequest srr = new SortRangeRequest();
GridRange gr = new GridRange();
SortSpec ss = new SortSpec();
Request req = new Request();
gr.SheetId = i_sheet_id;
gr.StartRowIndex = i_start_row_index;
gr.EndRowIndex = i_end_row_index;
gr.StartColumnIndex = i_start_col_index;
gr.EndColumnIndex = i_end_col_index;
srr.Range = gr;
ss.SortOrder = str_sort_direction;
// Sort by CompositeForSorting field
ss.DimensionIndex = i_sorted_column_index;
if (!b_error_occurred)
{
try
{
srr.SortSpecs = new List() { ss };
req.SortRange = srr;
busReq.Requests = new List() { req };
SpreadsheetsResource.BatchUpdateRequest bur = _sheetsService.Spreadsheets.BatchUpdate(
busReq, _spreadsheetId);
if (bur == null)
{
Program.LogIt("ERROR: Could not create BatchUpdate object.");
b_error_occurred = true;
}
if (!b_error_occurred)
{
Program.LogIt("Executing...");
BatchUpdateSpreadsheetResponse busr = bur.Execute();
Program.LogIt("Done.");
}
}
catch (Exception e)
{
Program.LogIt("ERROR: Could not sort records. Exception: " + e.Message + ", " + e.StackTrace);
b_error_occurred = true;
}
} // end if (!b_error_occurred)
Program.LogIt("end SortGoogleSheet()");
return !b_error_occurred;
} // end public bool SortGoogleSheet(ref bool b_error_occurred)
< /code>
Ich nenne die Funktion mit den folgenden Werten: < /p>
i_Sorted_column_index: 14 (nullbasiertes Index, so entspricht daher mit Spalte O, die 15. Spalte in der Tabelle) < /li>
i_start_row_index: 1 (nullbasiertes Index. Ich gehe davon aus, dass Sie eine Zeile überspringen, weil Sie den Header nicht sortieren möchten Namen Zeile?) < /li>
i_end_row_index: 10536 (nullbasiertes Index. Die letzte Zeile in der Tabelle ist Zeile Nr. 10537.) < /li>
i_start_index: 0 < /li>
i_end_col_index: 14 (Spalte O, die fünfzehnte Spalte in der Tabelle, ist die letzte Spalte in der Tabelle) < /li>
str_sort_direction: "Ascending" < /li>
< /ul>
Der Aufruf an BatchUpDatePreadsheetresponse busr = bur.execute (); < /Code> Gibt den folgenden Fehler zurück: < /p>
ERROR: Could not sort records. Exception: Google.Apis.Requests.RequestError
Internal error encountered. [500]
Errors [
Message[Internal error encountered.] Location[ - ] Reason[backendError] Domain[global]
]
, at Google.Apis.Requests.ClientServiceRequest`1.
d__35.MoveNext() in C:\Apiary\2021-09-08.15-52-39\Src\Support\Google.Apis\Requests\ClientServiceRequest.cs:line
258
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Google.Apis.Requests.ClientServiceRequest`1.Execute() in C:\Apiary\2021-09-08.15-52-39\Src\Support\Google.Apis\Requests\ClientServiceRequest.cs:line 180
Ich habe ein C# -Programm, mit dem Werte in meinem Google -Blatt hinzufügen und bearbeiten und entfernen können. Aber ich kann die Datensätze in der Tabelle nicht richtig sortieren. Hier ist mein Code: < /p> [code]public bool SortGoogleSheet( int i_sorted_column_index, int i_start_row_index, int i_end_row_index, int i_start_col_index, int i_end_col_index,
int i_sheet_id = GetSheetId(_sheetsService, _spreadsheetId, sheetname);
BatchUpdateSpreadsheetRequest busReq = new BatchUpdateSpreadsheetRequest(); SortRangeRequest srr = new SortRangeRequest(); GridRange gr = new GridRange(); SortSpec ss = new SortSpec(); Request req = new Request();
// Sort by CompositeForSorting field ss.DimensionIndex = i_sorted_column_index;
if (!b_error_occurred) { try { srr.SortSpecs = new List() { ss }; req.SortRange = srr; busReq.Requests = new List() { req }; SpreadsheetsResource.BatchUpdateRequest bur = _sheetsService.Spreadsheets.BatchUpdate( busReq, _spreadsheetId);
if (bur == null) { Program.LogIt("ERROR: Could not create BatchUpdate object."); b_error_occurred = true; }
if (!b_error_occurred) { Program.LogIt("Executing..."); BatchUpdateSpreadsheetResponse busr = bur.Execute(); Program.LogIt("Done."); } } catch (Exception e) { Program.LogIt("ERROR: Could not sort records. Exception: " + e.Message + ", " + e.StackTrace); b_error_occurred = true; } } // end if (!b_error_occurred)
Program.LogIt("end SortGoogleSheet()");
return !b_error_occurred; } // end public bool SortGoogleSheet(ref bool b_error_occurred) < /code> Ich nenne die Funktion mit den folgenden Werten: < /p>
i_Sorted_column_index: 14 (nullbasiertes Index, so entspricht daher mit Spalte O, die 15. Spalte in der Tabelle) < /li> i_start_row_index: 1 (nullbasiertes Index. Ich gehe davon aus, dass Sie eine Zeile überspringen, weil Sie den Header nicht sortieren möchten Namen Zeile?) < /li> i_end_row_index: 10536 (nullbasiertes Index. Die letzte Zeile in der Tabelle ist Zeile Nr. 10537.) < /li> i_start_index: 0 < /li> i_end_col_index: 14 (Spalte O, die fünfzehnte Spalte in der Tabelle, ist die letzte Spalte in der Tabelle) < /li> str_sort_direction: "Ascending" < /li> < /ul> Der Aufruf an BatchUpDatePreadsheetresponse busr = bur.execute (); < /Code> Gibt den folgenden Fehler zurück: < /p> ERROR: Could not sort records. Exception: Google.Apis.Requests.RequestError Internal error encountered. [500] Errors [ Message[Internal error encountered.] Location[ - ] Reason[backendError] Domain[global] ] , at Google.Apis.Requests.ClientServiceRequest`1. d__35.MoveNext() in C:\Apiary\2021-09-08.15-52-39\Src\Support\Google.Apis\Requests\ClientServiceRequest.cs:line 258 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Google.Apis.Requests.ClientServiceRequest`1.Execute() in C:\Apiary\2021-09-08.15-52-39\Src\Support\Google.Apis\Requests\ClientServiceRequest.cs:line 180 [/code] Was bedeutet das und wie behebte ich das?
Ich bin ein Anfänger -Webentwickler, der ein Online -RSVP -Formular erstellt, das Daten über ein Heroku -Proxy- und Google -Apps -Skript in einem Google -Blatt speichern sollte. Während des Abrufens...
Ich verwende das Google Apps -Skript, um Daten von Google Sheets in Google Slides einzugeben. Ich möchte, dass der Wert und die Formatierung, die in Google Sheets angezeigt wird, auf Google Slides...
Ich exportiere meine Daten in Google Sheets mit der GSPREAD -Bibliothek für Python. In Local Everything hat ein Browser für Auth geöffnet und kann ihn exportieren. Wenn ich es in einem Docker...
Ich exportiere meine Daten in Google Sheets mit der GSPREAD -Bibliothek für Python. In Local Everything hat ein Browser für Auth geöffnet und kann ihn exportieren. Wenn ich es in einem Docker...
Ich versuche ein Google -Formular zu erstellen, das ein Google -Blatt bevölkert. Ich habe das Formular Fitnessstudio Form A und Fitnessform B , das funktioniert, aber A wird nicht automatisch zu b.i...