Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google sheets 如何使用google sheets4板条箱构造适当的值更新调用?_Google Sheets_Rust_Crate - Fatal编程技术网

Google sheets 如何使用google sheets4板条箱构造适当的值更新调用?

Google sheets 如何使用google sheets4板条箱构造适当的值更新调用?,google-sheets,rust,crate,Google Sheets,Rust,Crate,目前,为了让一个基本的示例正常工作,我尝试使用这个示例将单元格A1:A4的值更新为“1” 这是一个错误的请求。我已经验证了我的auth是有效的,并且我能够像这样编辑电子表格 let mut req = sheets4::ClearValuesRequest::default(); let result = hub.spreadsheets().values_clear(req, SPREADSHEET_ID, "A1:B2").doit(); 这将按预期清除A1:B2 理想情况下,我希望有一个

目前,为了让一个基本的示例正常工作,我尝试使用这个示例将单元格A1:A4的值更新为“1”

这是一个错误的请求。我已经验证了我的auth是有效的,并且我能够像这样编辑电子表格

let mut req = sheets4::ClearValuesRequest::default();
let result = hub.spreadsheets().values_clear(req, SPREADSHEET_ID, "A1:B2").doit();
这将按预期清除A1:B2

理想情况下,我希望有一个这样的函数

batch_update(&[1,2,3,4, (etc)], &["A1", "B2", "F3", "G42", (etc)]);

这将设置单元格A1、B2、F3。。到1,2,3。除了基本用法之外,我对谷歌电子表格和电子表格完全不熟悉。

我应该阅读谷歌电子表格api官方文档,而不是板条箱文档。在官方文档中,我发现了这一点,这有助于我获得一个基本示例:

let mut req = sheets4::ValueRange::default();
req.range = Some(String::from("A1:D6"));
req.major_dimension = Some(String::from("ROWS"));
req.values = Some(vec![
    vec!["Item".to_owned(), "Cost".to_owned(), "Stocked".to_owned(), "Ship Date".to_owned()],
    vec!["Wheel".to_owned(), "$20.50".to_owned(), "4".to_owned(), "3/1/2016".to_owned()],
    vec!["Wheel".to_owned(), "$20.50".to_owned(), "4".to_owned(), "3/1/2016".to_owned()],
    vec!["Wheel".to_owned(), "$20.50".to_owned(), "4".to_owned(), "3/1/2016".to_owned()],
    vec!["Wheel".to_owned(), "$20.50".to_owned(), "4".to_owned(), "3/1/2016".to_owned()],
    vec!["Wheel".to_owned(), "$20.50".to_owned(), "=SUM(C2:C5)".to_owned(), "3/1/2016".to_owned()],
]);

let result = hub.spreadsheets().values_update(req, SPREADSHEET_ID, "A1:D6")
    .value_input_option("USER_ENTERED")
    .doit();

我本应该阅读官方的GoogleSheetsAPI文档,而不是板条箱文档。在官方文档中,我发现了这一点,这有助于我获得一个基本示例:

let mut req = sheets4::ValueRange::default();
req.range = Some(String::from("A1:D6"));
req.major_dimension = Some(String::from("ROWS"));
req.values = Some(vec![
    vec!["Item".to_owned(), "Cost".to_owned(), "Stocked".to_owned(), "Ship Date".to_owned()],
    vec!["Wheel".to_owned(), "$20.50".to_owned(), "4".to_owned(), "3/1/2016".to_owned()],
    vec!["Wheel".to_owned(), "$20.50".to_owned(), "4".to_owned(), "3/1/2016".to_owned()],
    vec!["Wheel".to_owned(), "$20.50".to_owned(), "4".to_owned(), "3/1/2016".to_owned()],
    vec!["Wheel".to_owned(), "$20.50".to_owned(), "4".to_owned(), "3/1/2016".to_owned()],
    vec!["Wheel".to_owned(), "$20.50".to_owned(), "=SUM(C2:C5)".to_owned(), "3/1/2016".to_owned()],
]);

let result = hub.spreadsheets().values_update(req, SPREADSHEET_ID, "A1:D6")
    .value_input_option("USER_ENTERED")
    .doit();