我有一个超过3000行的Google表格。有些行包含不相关的单词。因此,我需要一种批量删除这些单词的方法。例如,单元格将包含以下内容:
# | Product
-------------------------------
1 | Cool new product
2 | Old product
3 | Product that's old
Run Code Online (Sandbox Code Playgroud)
我想删除所有包含单词“ old”的行。
我发现一个脚本完成了一半的工作,但是它需要“单词”来匹配整个单元,而不仅仅是某些单元。
以下代码中的第17行是需要调整的内容:
16 |
17 | if (row[1] == 'old')
18 |
Run Code Online (Sandbox Code Playgroud)
这是代码:
/**
* Deletes rows in the active spreadsheet that contain 'word' in column B
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
var values = rows.getValues(); …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用适用于Android的Google Sheets API(v4),但找不到如何使用values().update()或batchUpdate()方法更新工作表的特定工作簿的方法。
有谁知道如何做到这一点?
编辑:澄清一下,我正在使用此API:(来自build.gradle)
compile('com.google.api-client:google-api-client-android:1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
compile('com.google.apis:google-api-services-sheets:v4-rev28-1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
Run Code Online (Sandbox Code Playgroud) 我想在谷歌驱动器上为我的电子表格创建下载链接,我读到了类似的内容:
https://docs.google.com/spreadsheets/d/MY_SPREADSHEET/export?format=csv
Run Code Online (Sandbox Code Playgroud)
但它只下载第一张表。我已经阅读了GID参数,但我不想花时间开发一些可以从 API 获取所有 GID 的东西,然后下载每个工作表。有没有办法让一个链接可以下载整个电子表格?
google-api google-sheets google-spreadsheet-api google-drive-api
我正在尝试为我的Google电子表格API指定一个名称.这是在'title'键值中完成的.我已尝试使用以下内容,但它为现有的json添加了一个新密钥.有没有办法获得并使用该项"title": ""更新该值new_date?
prev_date = datetime.date.today()-datetime.timedelta(1)
new_date = str(prev_date.isoformat())
res = {
"requests": [
{
"addSheet": {
"properties": {
"title": ""
}
}
}
]
}
res['title'] = new_date
print (res)
Run Code Online (Sandbox Code Playgroud)
这是输出:
{'requests': [{'addSheet': {'properties': {'title': ''}}}], 'title': '2016-12-29'}
Run Code Online (Sandbox Code Playgroud)
这就是我希望它:
{'requests': [{'addSheet': {'properties': {'title': '2016-12-29'}}}]}
Run Code Online (Sandbox Code Playgroud) 是否可以使用SQL类型查询连接到GAS中的Google Spreadsheet?如果是这样,任何工作样品?
谢谢.
我想使用 Google Spreadsheet API更改电子表格的行颜色。
我正在使用JAVA,我看到它在JavaScript 中工作,但我没有在JAVA 中找到它。
我们使用 Google Sheet API v4。我们想用空数据清除整个工作表。我们不想删除行/列。
我试图在 Google 电子表格上添加日期。为了添加日期,我们在纪元中转换了日期。
对于电子表格时代
Google 表格使用电子表格中常用的一种纪元日期形式。值的整数部分(小数点左边)计算自 1899 年 12 月 30 日以来的天数。小数部分(小数点右边)将时间计算为一天的分数。例如,1900 年 1 月 1 日中午是 2.5,2 因为它是 1899 年 12 月 30 日之后的两天,0.5 因为中午是半天。1900 年 2 月 1 日下午 3 点将是 33.625。
我们使用 Joda 时间 API 进行计算。(我们的 JDK 版本 1.7)。
对于整数,我们使用以下代码。
public static double getEpochDate(Date inputDate)
{
MutableDateTime epoch = new MutableDateTime();
epoch.setTime(0, 0, 0, 0);
epoch.setDate(1899,12,30); //Set to Epoch time
System.out.println(epoch);
DateTime now = new DateTime(inputDate);
Days days = Days.daysBetween(epoch, now);
return Double.valueOf(days.getDays());
}
Run Code Online (Sandbox Code Playgroud)
我们正面临寻找时代编号的派系部分的问题
java spreadsheet epoch google-spreadsheet-api google-sheets-api
我开发了一个测试自动化框架,目前在 excel 表中为测试用例编写通过或失败值。我们已决定迁移到 Google 表格。
任何人都可以提供示例 Java 代码以使用 Google Sheet API V4 将数据写入 Google Sheet?
我有一个看表文档,但不清楚。
谢谢你。
我正在尝试使用本地(mac)python程序向google工作表附加一行.我天真地认为下面的代码就足够了:
import requests
url = "https://sheets.googleapis.com/v4/spreadsheets/SHEETID/values/Expenses!A1:D1:append?valueInputOption=USER_ENTERED"
data = {
"range": "Expenses!A1:D1",
"majorDimension": "ROWS",
"values": [
[NEW ROW DATA]]
],
}
resp = requests.post(url, data)
Run Code Online (Sandbox Code Playgroud)
我收到错误:
401:"请求缺少必需的身份验证凭据.预期的OAuth 2访问令牌,登录cookie或其他有效的身份验证凭据.
我不确定如何为google sheet rest api设置身份验证.
任何人都可以举例说明如何解决这个问题.
java ×4
android ×1
dictionary ×1
epoch ×1
google-api ×1
javascript ×1
json ×1
oauth-2.0 ×1
python ×1
python-2.7 ×1
spreadsheet ×1