Использование google.apis.sheets.v4 В c#, добавление значения на конкретные ячейки заставляет значение перейти к последней неиспользованной строке в столбце A. Я могу обновить AK15 с значением, но обновление AK6 ISN ' T Работа. Я обновил более 50 столбцов в AI-AL, но ячейки AK6, AK5 и AJ4 вызывает эту проблему каждый раз, когда я пытаюсь их обновить. У кого -нибудь еще была эта проблема? < /P>
UserCredential credential;
using (var stream =
new FileStream(ReadXMLFileForSettings.Configs["gCredLocation"], FileMode.Open, FileAccess.Read))
{
// The file token.json stores the user's access and refresh tokens, and is created
// automatically when the authorization flow completes for the first time.
string credPath = ReadXMLFileForSettings.Configs["TokenLocation"];
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
Scopes,
"user",
CancellationToken.None,
new FileDataStore(credPath, true));
}
// Create Google Sheets API service.
var service = new SheetsService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Check Underperformance VAs"
});
int counter = 0;
foreach (var monthCounter in MonthCounters)
{
int row = monthCounter.batch - 65;
//get the column Letter based on
int column = (monthCounter.year - 2022) * 12;
string columnLetter = string.Empty;
while (column > 0)
{
column--; // Decrement to make it 0-indexed
columnLetter = (char)(column % 26 + 'A') + columnLetter;
column /= 26;
}
string Cell = "Underperformance Heat Map!" + columnLetter + row;
counter++;
var newValue = new ValueRange()
{
Values = new[] { new[] { counter.ToString() } }
};
var updateRequest = service.Spreadsheets.Values.Append(newValue, SpreadsheetId, Cell);
updateRequest.ValueInputOption = (SpreadsheetsResource.ValuesResource.AppendRequest.ValueInputOptionEnum?)SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.USERENTERED;
// Get the response from the update request
var result = await updateRequest.ExecuteAsync().ConfigureAwait(false);
Logging.WriteToLog($"Updated {Cell} - {counter}");
}
Подробнее здесь: https://stackoverflow.com/questions/793 ... e-ran-into
Обновление ячейки docs.google.com обновляет неверную ячейку, кто -нибудь сталкивался с этой проблемой раньше? ⇐ C#
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение