我可以使用Update()更新单个NamedRange,使用BatchUpdate更新多个GridCoordinate范围,但我无法解决如何在BatchUpdate中更新NamedRanges。这是怎么做到的?
单个NamedRange更新我可以这样做:
ValueRange vr = new ValueRange();
vr.Range = "aRange";
var l1 = new List<object>();
l1.Add("Here");
IList<IList<object>> l2 = new List<IList<object>>();
l2.Add(l1);
vr.Values = l2;
var rqe2 = service.Spreadsheets.Values.Update(vr, spreadsheetId, "aRange");
rqe2.ValueInputOption = SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.USERENTERED;
rqe2.Execute();
通过BatchUpdate 和GridCoordinate我可以这样做:
BatchUpdateSpreadsheetRequest busr = new BatchUpdateSpreadsheetRequest();
busr.Requests = new List<Request>();
Request r = new Request();
busr.Requests.Add(r);
r.UpdateCells = new UpdateCellsRequest();
var gc = new GridCoordinate();
gc.ColumnIndex = 0;
gc.RowIndex = 5;
gc.SheetId = 0;
r.UpdateCells.Start = gc;
r.UpdateCells.Fields = "*";
r.UpdateCells.Rows = new List<RowData>();
var rd = new RowData();
r.UpdateCells.Rows.Add(rd);
rd.Values = new List<CellData>();
var cd = new CellData();
cd.UserEnteredValue = new ExtendedValue();
cd.UserEnteredValue.StringValue = "UserEnteredValue";
rd.Values.Add(cd);
SpreadsheetsResource.BatchUpdateRequest bur = service.Spreadsheets.BatchUpdate(busr, spreadsheetId);
bur.Execute();
答案 0 :(得分:2)
您正在使用上述两种不同类型的更新values.update&amp; spreadsheets.batchUpdate
const path = require("path");
const merge = require("webpack-merge");
const parts = require( "./webpack.config.parts" );
const PATHS = {
app : path.join( __dirname, "app" ),
build : path.join( __dirname, "build" )
};
const common = {
entry : {
app : "./app/index.js"
},
output : {
filename : "run.build.js",
path : PATHS.build
},
resolve : {
alias : {
assets : path.resolve( __dirname, "app/assets" ),
components : path.resolve( __dirname, "app/components" )
},
extensions : [ "js", "jsx" ]
}
};
var config;
switch( process.env.npm_lifecycle_event ){
case( "build-Prod" ): {
...
}
case( "start-Dev" ):
default: {
const eslintPath = path.join( __dirname, "/.eslintrc" );
config = merge( common,
parts.eslint( PATHS.app, eslintPath ),
parts.babel( PATHS.app ),
parts.devServer( PATHS.app ),
parts.htmlWebpackPlugin());
}
}
module.exports = config;
API集合适用于A1范围,包括命名范围,工作表名称,行号(从1开始)和列字母。 const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
exports.babel = function( path ){
var standardPresets = [
"react",
"es2015"
];
var presets;
presets = standardPresets;
}
return({
module: {
rules : [
{
test : /\.jsx?$/,
include : path,
use : [
{
loader: "babel-loader",
options : {
presets
}
}
]
}
]
}
});
};
exports.devServer = function() {
return ({
devServer: {
historyApiFallback: true,
hot: true,
inline: true,
stats: "errors-only"
},
plugins: [
new webpack.HotModuleReplacementPlugin({
multiStep: true
})
]
});
};
exports.eslint = function( path, configFilePath ){
return ({
module: {
rules : [
{
test : /\.jsx?$/,
enforce : "pre",
include : path,
use : [
{
loader : "eslint-loader",
options : {
configFile : configFilePath
}
}
]
}
]
}
});
};
exports.htmlWebpackPlugin = function( ) {
return ({
plugins: [
new HtmlWebpackPlugin({
title: "title"
})
]
});
};
API集合适用于values
,spreadsheets
,GridRange
等对象,所有这些对象都使用工作表ID和行/列索引(从0开始)
如果您想在命名范围内批量更新值,则需要使用values.batchUpdate API,而不是GridCoordinate
API。
C#中的API应该是参考文档信息的相当简单的映射,可能使用DimensionRange
。