- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我一直在 iOS swift 中开发 Google SpreadSheet API,但是在 iOS Swift 中更新 SpreadSheet 行/数据中的特定字段时出现问题,
以下是在电子表格顶部添加一行的代码,但我想要特定索引或匹配特定值,
let service = GTLRSheetsService()
service.authorizer = GIDSignIn.sharedInstance().currentUser.authentication.fetcherAuthorizer()
service.apiKey = Constants.GOOGLE_SPEADSHEET_API_KEY
let range = "Employee List!A2:D"
let valueRange = GTLRSheets_ValueRange.init()
valueRange.values = [[job.jobTitle!]] //want to add job title on specific field after maching employee name
let query = GTLRSheetsQuery_SpreadsheetsValuesUpdate.query(withObject: valueRange, spreadsheetId: Constants.SPREAD_SHEET_ID, range: range)
query.valueInputOption = "USER_ENTERED"
service.executeQuery(query) { (ticket, response, error) in
print(response)
}
此代码在 B2 列的顶部添加职位名称,但我想通过检查名称然后根据名称添加职位来将其添加到特定行。
PS:数据如下
Want to add job title by matching the particular employee name, ref to image
有人可以帮我吗?
非常感谢
最佳答案
您应该为要更新的单元格定义一个准确的范围。它可能看起来像这样:
let service = GTLRSheetsService()
service.authorizer = GIDSignIn.sharedInstance().currentUser.authentication.fetcherAuthorizer()
service.apiKey = Constants.GOOGLE_SPEADSHEET_API_KEY
let rowIndex:Int = job.rowIndex
let range = "Employee List!C\(rowIndex):C\(rowIndex)"
let valueRange = GTLRSheets_ValueRange()
valueRange.range = "Employee List!C\(rowIndex):C\(rowIndex)"
valueRange.values = [[job.jobTitle!]]
valueRange.majorDimension = "COLUMNS"
let query = GTLRSheetsQuery_SpreadsheetsValuesUpdate.query(withObject: valueRange, spreadsheetId: Constants.SPREAD_SHEET_ID, range: range)
query.valueInputOption = "USER_ENTERED"
service.executeQuery(query) { (ticket, response, error) in
print(response)
}
并且不要忘记在 GIDSignIn.sharedInstance().scopes
中定义正确的范围
关于ios - 使用 Google SpreadSheet API 更新 iOS Swift 中的特定行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51585042/
我试图找出对电子表格建模的最佳方法(从数据库的角度来看),考虑到: 电子表格可以包含可变数量的行。 电子表格可以包含可变数量的列。 每一列可以包含一个值,但其类型未知(整数、日期、字符串)。 生成包含
我在谷歌表格中有一个整列的数组公式,例如C1中的以下公式 ArrayFormula(A1:A+B1:B) A列和B列有数据。 如果我要捕获一行并将其移动到另一个位置。一旦我移动它,该行 C 列中的相应
我正在尝试使用 Net::Google::Spreadsheets 读出(稍后甚至可能写入)Google 电子表格。 最样板脚本死于“登录失败”并且没有错误: use Net::Google::Spr
-我想做什么 我想在没有身份验证的情况下使用 Google 电子表格 API Java 库从 Google 电子表格获取数据。Google 电子表格是公开发布的。我想使用以下方法:com.google
使用phpSpredSheet开始使用PHP。测试基本代码会返回错误FATAL ERROR:UNAUCAT ERROR:CLASS“PhpOffice\PhpSpreadSheet\SpreadShe
我有一个 LibreOffice Calc 电子表格,用于跟踪工作中的应收账款。每张表都列出了发票及其状态(已付、未付等)以及有关每张发票的信息。我正在尝试创建一个汇总表,其中列出了每个表中的某些数据
我只是想让列自动调整大小。我正在使用 php 电子表格,但找不到如何操作。我搜索了其他问题,但他们使用了我在 lib worksheet.php 中找不到的函数,例如 getActiveSheet()
嗨,我在我的脚本参数中传递 2 个单元格时遇到问题: function myFunction(c1, c2) { var ss = SpreadsheetApp.getActiveSpreadshee
电子表格太漂亮了!单元格可以相互链接,如果任何公式/值/单元格之一发生任何变化,一切都会正确更新! 有谁知道电子表格如何做到这一点的一般概念? 我所说的是如果 A1 = 1、A2 = 2 和 A3 =
我有一个Powershell脚本,该脚本调用Google App Script函数。 运行Powershell脚本时,我可以在GCP项目的错误报告中看到以下错误: Exception: You do
我正在编写一个AWS Lambda代码,用于使用Golang访问和更新带有URL作为输入的电子表格。到目前为止,我已经可以按照Google指南使用OAuth客户端ID在本地访问电子表格-https:/
我们正在为我们的客户构建电子表格网络应用程序。他们可以上传任何 csv (20 MB+),然后对数据执行操作(如下所列)。数据高度非结构化。 在过去的几个月里,我们尝试了几种架构: 最初,我们以二维数
我遇到过这个 sumif 公式,我在 Google 搜索 N:N 时找不到任何帮助 =sumif(N:N,"Cat",C:C) 所以我根据文档理解了 SumIf: SUMIF(range, crite
我正在使用 C# WebApi 2,存储在未安装办公室的 Azure 服务器上。 我需要创建一个 excel 文件,并且知道 GemBox 电子表格不需要在机器上安装 office。 问题是我需要文件
我正在查看CellEntry API(https://developers.google.com/gdata/javadoc/com/google/gdata/data/spreadsheet/Cel
我需要使用谷歌电子表格 API 设置 majorDimension 值。我已经阅读了文档,它只是说我可以将值设置为 ROW 或 COLUMN,但它没有讨论如何在 URL 中执行此操作。 文档:http
如何使用 google spreadsheet feeds 从多张纸中获取提要api? 以下 URL 仅从第一张工作表中获取提要。在我的 spreadsheet我有 3 work sheets我也想获
请问有人可以帮忙解决 Google 电子表格中的一个问题吗? 更改“ field ”表中一个具体列中的值后,我想在更改该值时写入有关名称和时间的日志。但我无法真正意识到,如果我正在使用电子表格“ fi
我正在尝试创建一个多表 Excel 文档,到目前为止我一直在 PHP 中完成它 - 但使用 PHPExcel 总共大约 60,000 个电子表格单元格占用了 70MB 的 RAM。 我想知道是否有人有
在我的 Perl 脚本中,我使用 Spreadsheet::WriteExcel模块创建 Excel 文件。该文件包含一个表,其大小是动态的 - 即,在创建表之前我不知道它将有多少行。我希望表格的最后
我是一名优秀的程序员,十分优秀!