mirror of
https://github.com/block/goose.git
synced 2026-07-10 00:20:17 +00:00
chore(deps): bump umya-spreadsheet from 2.3.3 to 3.0.0 (#10248)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Douwe M Osinga <douwe@sidewalklabs.com>
This commit is contained in:
parent
140158c756
commit
4e2a992c5a
3 changed files with 42 additions and 86 deletions
60
Cargo.lock
generated
60
Cargo.lock
generated
|
|
@ -239,15 +239,6 @@ dependencies = [
|
|||
"object",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arbitrary"
|
||||
version = "1.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"
|
||||
dependencies = [
|
||||
"derive_arbitrary",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arboard"
|
||||
version = "3.6.1"
|
||||
|
|
@ -3504,17 +3495,6 @@ dependencies = [
|
|||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_arbitrary"
|
||||
version = "1.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_builder"
|
||||
version = "0.20.2"
|
||||
|
|
@ -11560,12 +11540,6 @@ dependencies = [
|
|||
"unicode-width 0.2.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thin-vec"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b0f7e269b48f0a7dd0146680fa24b50cc67fc0373f086a5b2f99bd084639b482"
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.69"
|
||||
|
|
@ -12516,12 +12490,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "umya-spreadsheet"
|
||||
version = "2.3.3"
|
||||
version = "3.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "408c7e039c96ec1d517a1111ade7fadab889f32c096dac691a1e3b8018c3e39a"
|
||||
checksum = "caf31e59909bf0fed6fc9df1d24bed0f135518eb2af05a330284f81ffcfb0513"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"ahash",
|
||||
"base64 0.22.1",
|
||||
"byteorder",
|
||||
"cbc",
|
||||
|
|
@ -12529,18 +12502,20 @@ dependencies = [
|
|||
"chrono",
|
||||
"encoding_rs",
|
||||
"fancy-regex 0.14.0",
|
||||
"getrandom 0.2.17",
|
||||
"hmac 0.12.1",
|
||||
"html_parser",
|
||||
"imagesize",
|
||||
"lazy_static",
|
||||
"jiff",
|
||||
"md-5",
|
||||
"num-traits",
|
||||
"paste",
|
||||
"phf 0.11.3",
|
||||
"quick-xml 0.37.5",
|
||||
"regex",
|
||||
"rand 0.8.6",
|
||||
"rgb",
|
||||
"sha2 0.10.9",
|
||||
"thin-vec",
|
||||
"thousands",
|
||||
"zip 2.4.2",
|
||||
"zip 8.6.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -14282,23 +14257,6 @@ dependencies = [
|
|||
"flate2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "2.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fabe6324e908f85a1c52063ce7aa26b68dcb7eb6dbc83a2d148403c9bc3eba50"
|
||||
dependencies = [
|
||||
"arbitrary",
|
||||
"crc32fast",
|
||||
"crossbeam-utils",
|
||||
"displaydoc",
|
||||
"flate2",
|
||||
"indexmap 2.14.0",
|
||||
"memchr",
|
||||
"thiserror 2.0.18",
|
||||
"zopfli",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "7.2.0"
|
||||
|
|
|
|||
|
|
@ -38,6 +38,6 @@ once_cell = { workspace = true }
|
|||
lopdf = { version = "0.42", default-features = false }
|
||||
docx-rs = { version = "0.4.18", default-features = false, features = ["image"] }
|
||||
image = { version = "0.24.4", default-features = false, features = ["bmp", "dds", "dxt", "farbfeld", "gif", "hdr", "ico", "jpeg", "jpeg_rayon", "openexr", "png", "pnm", "tga", "tiff", "webp"] }
|
||||
umya-spreadsheet = { version = "2", default-features = false }
|
||||
umya-spreadsheet = { version = "3", default-features = false }
|
||||
shell-words = { workspace = true }
|
||||
process-wrap = { version = "9", default-features = false, features = ["std"] }
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::{Context, Result};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::path::Path;
|
||||
use umya_spreadsheet::{Spreadsheet, Worksheet};
|
||||
use umya_spreadsheet::{structs::Workbook, Worksheet};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct WorksheetInfo {
|
||||
|
|
@ -28,7 +28,7 @@ pub struct RangeData {
|
|||
}
|
||||
|
||||
pub struct XlsxTool {
|
||||
workbook: Spreadsheet,
|
||||
workbook: Workbook,
|
||||
}
|
||||
|
||||
impl XlsxTool {
|
||||
|
|
@ -40,10 +40,10 @@ impl XlsxTool {
|
|||
|
||||
pub fn list_worksheets(&self) -> Result<Vec<WorksheetInfo>> {
|
||||
let mut worksheets = Vec::new();
|
||||
for (index, worksheet) in self.workbook.get_sheet_collection().iter().enumerate() {
|
||||
for (index, worksheet) in self.workbook.sheet_collection().iter().enumerate() {
|
||||
let (column_count, row_count) = self.get_worksheet_dimensions(worksheet)?;
|
||||
worksheets.push(WorksheetInfo {
|
||||
name: worksheet.get_name().to_string(),
|
||||
name: worksheet.name().to_string(),
|
||||
index,
|
||||
column_count,
|
||||
row_count,
|
||||
|
|
@ -54,13 +54,13 @@ impl XlsxTool {
|
|||
|
||||
pub fn get_worksheet_by_name(&self, name: &str) -> Result<&Worksheet> {
|
||||
self.workbook
|
||||
.get_sheet_by_name(name)
|
||||
.sheet_by_name(name)
|
||||
.context("Worksheet not found")
|
||||
}
|
||||
|
||||
pub fn get_worksheet_by_index(&self, index: usize) -> Result<&Worksheet> {
|
||||
self.workbook
|
||||
.get_sheet_collection()
|
||||
.sheet_collection()
|
||||
.get(index)
|
||||
.context("Worksheet index out of bounds")
|
||||
}
|
||||
|
|
@ -71,12 +71,12 @@ impl XlsxTool {
|
|||
let mut max_row = 0;
|
||||
|
||||
// Iterate through all rows
|
||||
for row_num in 1..=worksheet.get_highest_row() {
|
||||
for col_num in 1..=worksheet.get_highest_column() {
|
||||
if let Some(cell) = worksheet.get_cell((col_num, row_num)) {
|
||||
let coord = cell.get_coordinate();
|
||||
max_col = max_col.max(*coord.get_col_num() as usize);
|
||||
max_row = max_row.max(*coord.get_row_num() as usize);
|
||||
for row_num in 1..=worksheet.highest_row() {
|
||||
for col_num in 1..=worksheet.highest_column() {
|
||||
if let Some(cell) = worksheet.cell((col_num, row_num)) {
|
||||
let coord = cell.coordinate();
|
||||
max_col = max_col.max(coord.col_num() as usize);
|
||||
max_row = max_row.max(coord.row_num() as usize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -86,9 +86,9 @@ impl XlsxTool {
|
|||
|
||||
pub fn get_column_names(&self, worksheet: &Worksheet) -> Result<Vec<String>> {
|
||||
let mut names = Vec::new();
|
||||
for col_num in 1..=worksheet.get_highest_column() {
|
||||
if let Some(cell) = worksheet.get_cell((col_num, 1)) {
|
||||
names.push(cell.get_value().into_owned());
|
||||
for col_num in 1..=worksheet.highest_column() {
|
||||
if let Some(cell) = worksheet.cell((col_num, 1)) {
|
||||
names.push(cell.value().into_owned());
|
||||
} else {
|
||||
names.push(String::new());
|
||||
}
|
||||
|
|
@ -104,13 +104,13 @@ impl XlsxTool {
|
|||
for row_idx in start_row..=end_row {
|
||||
let mut row_values = Vec::new();
|
||||
for col_idx in start_col..=end_col {
|
||||
let cell_value = if let Some(cell) = worksheet.get_cell((col_idx, row_idx)) {
|
||||
let cell_value = if let Some(cell) = worksheet.cell((col_idx, row_idx)) {
|
||||
CellValue {
|
||||
value: cell.get_value().into_owned(),
|
||||
formula: if cell.get_formula().is_empty() {
|
||||
value: cell.value().into_owned(),
|
||||
formula: if cell.formula().is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(cell.get_formula().to_string())
|
||||
Some(cell.formula().to_string())
|
||||
},
|
||||
}
|
||||
} else {
|
||||
|
|
@ -142,12 +142,10 @@ impl XlsxTool {
|
|||
) -> Result<()> {
|
||||
let worksheet = self
|
||||
.workbook
|
||||
.get_sheet_by_name_mut(worksheet_name)
|
||||
.sheet_by_name_mut(worksheet_name)
|
||||
.context("Worksheet not found")?;
|
||||
|
||||
worksheet
|
||||
.get_cell_mut((col, row))
|
||||
.set_value(value.to_string());
|
||||
worksheet.cell_mut((col, row)).set_value(value.to_string());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
@ -171,18 +169,18 @@ impl XlsxTool {
|
|||
search_text.to_string()
|
||||
};
|
||||
|
||||
for row_num in 1..=worksheet.get_highest_row() {
|
||||
for col_num in 1..=worksheet.get_highest_column() {
|
||||
if let Some(cell) = worksheet.get_cell((col_num, row_num)) {
|
||||
for row_num in 1..=worksheet.highest_row() {
|
||||
for col_num in 1..=worksheet.highest_column() {
|
||||
if let Some(cell) = worksheet.cell((col_num, row_num)) {
|
||||
let cell_value = if !case_sensitive {
|
||||
cell.get_value().to_lowercase()
|
||||
cell.value().to_lowercase()
|
||||
} else {
|
||||
cell.get_value().to_string()
|
||||
cell.value().to_string()
|
||||
};
|
||||
|
||||
if cell_value.contains(&search_text) {
|
||||
let coord = cell.get_coordinate();
|
||||
matches.push((*coord.get_row_num(), *coord.get_col_num()));
|
||||
let coord = cell.coordinate();
|
||||
matches.push((coord.row_num(), coord.col_num()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -192,14 +190,14 @@ impl XlsxTool {
|
|||
}
|
||||
|
||||
pub fn get_cell_value(&self, worksheet: &Worksheet, row: u32, col: u32) -> Result<CellValue> {
|
||||
let cell = worksheet.get_cell((col, row)).context("Cell not found")?;
|
||||
let cell = worksheet.cell((col, row)).context("Cell not found")?;
|
||||
|
||||
Ok(CellValue {
|
||||
value: cell.get_value().into_owned(),
|
||||
formula: if cell.get_formula().is_empty() {
|
||||
value: cell.value().into_owned(),
|
||||
formula: if cell.formula().is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(cell.get_formula().to_string())
|
||||
Some(cell.formula().to_string())
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue