ver Jan22nd

updated all the existing calc configs
This commit is contained in:
David Chang
2024-01-22 12:42:50 +08:00
parent 552491f765
commit 7a85c76369
19 changed files with 245 additions and 78 deletions

View File

@@ -26,6 +26,8 @@ libreoffice --convert-to "csv:Text - txt - csv (StarCalc):44,34,UTF8,,,,false,tr
This command will generate `abc-Sheet1.csv` under `/home/user`. The last `1` in the conversion options indicates the sheet number (starting from 1) to export. Detailed usage should be referred to at [CSV Filter Options](https://help.libreoffice.org/latest/ro/text/shared/guide/csv_params.html).
Refer to `libreoffice_calc/21df9241-f8d7-4509-b7f1-37e501a823f7.json` for an example.
## Chrome
### Starting Chrome with Remote Debugging for Python

View File

@@ -247,17 +247,22 @@ def compare_table(result: str, expected: str, **options) -> float:
raise NotImplementedError("Unimplemented sheet check: {:}".format(r["type"]))
passes = passes and metric
if not passes:
break
return float(passes)
# }}} function compare_table #
if __name__ == '__main__':
path1 = "../../任务数据/LibreOffice Calc/Represent_in_millions_billions.xlsx"
path2 = "../../任务数据/LibreOffice Calc/Represent_in_millions_billions_gold.xlsx"
rules = [ { "type": "sheet_print"
path1 = "../../任务数据/LibreOffice Calc/Freeze_row_column.xlsx"
path2 = "../../任务数据/LibreOffice Calc/Freeze_row_column_gold.xlsx"
rules = [ { "type": "sheet_data"
, "sheet_idx0": 0
, "sheet_idx1": "EI0"
}
, { "type": "freeze"
, "sheet_idx0": 0
, "sheet_idx1": "EI0"
, "ignore_case": "true"
}
]
print( compare_table( path1, path2

View File

@@ -72,7 +72,7 @@
"ref": 260
},
{
"type": "table_data",
"type": "sheet_data",
"sheet_idx0": 0,
"sheet_idx1": "EI0"
}

View File

@@ -100,8 +100,8 @@
"rules": [
{
"type": "sheet_print",
"sheet_idx0": 0,
"sheet_idx1": "EI0",
"sheet_idx0": "RNSheet1",
"sheet_idx1": "ENSheet1",
"ignore_case": true
}
]

View File

@@ -63,8 +63,18 @@
"dest": "OrderId_Month_Chart.xlsx"
},
"options": {
"features": [
"sparkline"
"rules": [
{
"type": "sparkline",
"sheet_idx0": 0,
"sheet_idx1": "EI0"
},
{
"type": "sheet_data",
"sheet_idx0": 0,
"sheet_idx1": "EI0"
}
]
}
}
}

View File

@@ -1,7 +1,7 @@
{
"id": "347ef137-7eeb-4c80-a3bb-0951f26a8aff",
"snapshot": "libreoffice_calc",
"instruction": "Could you create two column charts of per-month costs for me using statistics in the form?",
"instruction": "Here are two tables recording the per-month costs in 2019 and 2020. I want to create two column bar charts reflecting per-month cost variations for each year from these data. Help me, Mr. Assistant!",
"source": "https://www.youtube.com/watch?v=bgO40-CjYNY",
"config": [
{
@@ -64,12 +64,21 @@
"dest": "Create_column_charts_using_statistics_gold.xlsx"
},
"options": {
"features": [
"chart"
],
"chart_props": [
"type",
"direction"
"rules": [
{
"type": "chart",
"sheet_idx0": 0,
"sheet_idx1": "EI0",
"chart_props": [
"type",
"direction"
]
},
{
"type": "sheet_data",
"sheet_idx0": 0,
"sheet_idx1": "EI0"
}
]
}
}

View File

@@ -1,7 +1,7 @@
{
"id": "37608790-6147-45d0-9f20-1137bb35703d",
"snapshot": "libreoffice_calc",
"instruction": "Help me fill the columns of First Name, Last Name and Rank",
"instruction": "The information are mixed in one field. Help me split them and fill in the columns of First Name, Last Name and Rank",
"source": "https://www.youtube.com/shorts/uzPo_CPCHH8",
"config": [
{
@@ -9,7 +9,7 @@
"parameters": {
"files": [
{
"url": "https://101.43.24.67/s/FBip5fXoR4KEJaa",
"url": "https://drive.usercontent.google.com/download?id=1wDqap5cBfxnlqTNrZG61k_wDWTujl6AU&export=download&authuser=0&confirm=t&uuid=3c8203ea-c38f-411e-a7ea-bbb107548820&at=APZUnTVGfTjNFeZpqjITXs53uU3q:1705893319445",
"path": "/home/user/Employee_Roles_and_Ranks.xlsx"
}
]
@@ -27,16 +27,50 @@
"libreoffice calc"
],
"evaluator": {
"postconfig": [
{
"type": "activate_window",
"parameters": {
"window_name": "Employee_Roles_and_Ranks.xlsx - LibreOffice Calc",
"strict": true
}
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
}
},
{
"type": "execute",
"parameters": {
"command": [
"python",
"-c",
"import pyautogui; pyautogui.press([\"ctrl\", \"s\"]);"
]
}
}
],
"func": "compare_table",
"expected": {
"type": "cloud_file",
"path": "https://101.43.24.67/s/wr7B4GeotNNoeHD",
"path": "https://drive.usercontent.google.com/download?id=1dxpiUqP_CVvQp5tddxlwO3Cp1BqJ-ZDE&export=download&authuser=0&confirm=t&uuid=c79992d0-547f-4dc8-ae99-ff25327e04c6&at=APZUnTVARKZ-4KG_DHs1vAbbaaL_:1705893286722",
"dest": "Employee_Roles_and_Ranks_gold.xlsx"
},
"result": {
"type": "vm_file",
"path": "/home/user/Employee_Roles_and_Ranks.xlsx",
"dest": "Employee_Roles_and_Ranks.xlsx"
},
"options": {
"rules": [
{
"type": "sheet_data",
"sheet_idx0": 0,
"sheet_idx1": "EI0"
}
]
}
}
}

View File

@@ -1,7 +1,7 @@
{
"id": "4188d3a4-077d-46b7-9c86-23e1a036f6c1",
"snapshot": "libreoffice_calc",
"instruction": "Help me freeze the range A1:B5 on this sheet",
"instruction": "Help me freeze the range A1:B1 on this sheet to keep the headers always visible",
"source": "https://www.libreofficehelp.com/freeze-unfreeze-rows-columns-ranges-calc/",
"config": [
{
@@ -9,7 +9,7 @@
"parameters": {
"files": [
{
"url": "https://drive.usercontent.google.com/download?id=1ZhGLDKOden_oxzuN2xN9-jNQSHtCX6GE&export=download&authuser=0&confirm=t&uuid=2c097276-a610-4a9f-b6e4-5b54296c1555&at=APZUnTWc7zKPY_ykygn0mO1SAs4s:1703580957447",
"url": "https://drive.usercontent.google.com/download?id=1pmTn-32BIwXOu2NXgQG7-PCRPaNL5bYN&export=download&authuser=0&confirm=t&uuid=13f1a8fd-997e-4364-a182-ad8768eaac6a&at=APZUnTUOM1rcgxy87qxR1Rkdwdor:1705895562093",
"path": "/home/user/Freeze_row_column.xlsx"
}
]
@@ -52,17 +52,30 @@
}
}
],
"func": "check_xlsx_freeze",
"func": "compare_table",
"result": {
"type": "vm_file",
"path": "/home/user/Freeze_row_column.xlsx",
"dest": "Freeze_row_column.xlsx"
},
"expected": {
"type": "rule",
"rules": {
"position": "C6"
}
"type": "cloud_file",
"path": "https://drive.usercontent.google.com/download?id=1oTsiIJFiAIFaTo320izMP7ml1RDCctgD&export=download&authuser=0&confirm=t&uuid=e3ec92c6-c2bf-4a7e-8e10-c8287350c9c6&at=APZUnTXEp-KV7bido8GcENfWIxME:1705895589811",
"dest": "Freeze_row_column_gold.xlsx"
},
"options": {
"rules": [
{
"type": "freeze",
"sheet_idx0": 0,
"sheet_idx1": "EI0"
},
{
"type": "sheet_data",
"sheet_idx0": 0,
"sheet_idx1": "EI0"
}
]
}
}
}

View File

@@ -1,7 +1,7 @@
{
"id": "4f07fbe9-70de-4927-a4d5-bb28bc12c52c",
"snapshot": "libreoffice_calc",
"instruction": "Could you help me padding numbers to three decimals when used within formula?",
"instruction": "Here I want to use the numerical value from a cell in the text. I can set its number of decimal digits to 2 in the original value cell but don't know how to fix it in the text as well. Please help me to do this.",
"source": "https://superuser.com/questions/1081048/libreoffice-calc-how-to-pad-number-to-fixed-decimals-when-used-within-formula",
"config": [
{
@@ -31,7 +31,7 @@
{
"type": "activate_window",
"parameters": {
"window_name": "OrderId_Month_Chart.xlsx - LibreOffice Calc",
"window_name": "Padding_Decimals_In_Formular.xlsx - LibreOffice Calc",
"strict": true
}
},
@@ -50,18 +50,59 @@
"import pyautogui; pyautogui.press([\"ctrl\", \"s\"]);"
]
}
},
{
"type": "sleep",
"parameters": {
"seconds": 0.5
}
},
{
"type": "execute",
"parameters": {
"command": [
"libreoffice",
"--convert-to",
"csv:Text - txt - csv (StarCalc):44,34,UTF-8,,,,false,true,true,false,false,1",
"--outdir",
"/home/user",
"/home/user/Padding_Decimals_In_Formular.xlsx"
]
}
}
],
"func": "compare_table",
"result": {
"type": "vm_file",
"path": "/home/user/Padding_Decimals_In_Formular_gold.xlsx",
"dest": "Padding_Decimals_In_Formular.xlsx"
"path": [
"/home/user/Padding_Decimals_In_Formular.xlsx",
"/home/user/Padding_Decimals_In_Formular-Sheet1.csv"
],
"dest": [
"Padding_Decimals_In_Formular.xlsx",
"Padding_Decimals_In_Formular-Sheet1.csv"
],
"multi": true
},
"expected": {
"type": "cloud_file",
"path": "https://drive.usercontent.google.com/download?id=1DJTBic8_DREPhcau1GUkISfRm-L6xbBv&export=download&authuser=0&confirm=t&uuid=18e7d364-37fb-4e7f-baf1-9444ae5813ba&at=APZUnTXYuAaQ-Aa-2yqTn_2MXe0u:1704200380362",
"dest": "Padding_Decimals_In_Formular_gold.xlsx"
"path": [
"https://drive.usercontent.google.com/download?id=1DJTBic8_DREPhcau1GUkISfRm-L6xbBv&export=download&authuser=0&confirm=t&uuid=18e7d364-37fb-4e7f-baf1-9444ae5813ba&at=APZUnTXYuAaQ-Aa-2yqTn_2MXe0u:1704200380362",
"https://drive.usercontent.google.com/download?id=1Wy0Vf9Ivo6TLAv1nmkkkWTw0w14_hZIk&export=download&authuser=0&confirm=t&uuid=ad79fcff-1c23-4c11-aa47-a6a606f0a053&at=APZUnTUaukeh54t-7G1vWCms1AxS:1705896771858"
],
"dest": [
"Padding_Decimals_In_Formular_gold.xlsx",
"Padding_Decimals_In_Formular_gold-Sheet1.xlsx"
]
},
"options": {
"rules": [
{
"type": "sheet_print",
"sheet_idx0": "RNSheet1",
"sheet_idx1": "ENSheet1"
}
]
}
}
}

View File

@@ -62,6 +62,15 @@
"type": "vm_file",
"path": "/home/user/Name_Order_Id_move_column.xlsx",
"dest": "Name_Order_Id_move_column.xlsx"
},
"options": {
"rules": [
{
"type": "sheet_data",
"sheet_idx0": 0,
"sheet_idx1": "EI0"
}
]
}
}
}

View File

@@ -1,22 +0,0 @@
{
"id": "7b802dad-6e0f-4204-9815-d4e3f57627d8",
"snapshot": "libreoffice_calc",
"instruction": "I would like to sort this table based on cell color, placing all the rows marked with pink at the beginning, while keeping their order among themselves unchanged.",
"source": "https://www.youtube.com/shorts/Of-lzeP1usE",
"config": {
"download": [
[
"",
"C:\\Users\\tianbaox\\Desktop\\Customer_Sort_by_cell_color.xlsx"
]
],
"open": [
"C:\\Users\\tianbaox\\Desktop\\Customer_Sort_by_cell_color.xlsx"
]
},
"trajectory": "trajectories/7b802dad-6e0f-4204-9815-d4e3f57627d8",
"related_apps": [
"libreoffice calc"
],
"evaluator": "evaluation_dir"
}

View File

@@ -62,6 +62,15 @@
"type": "vm_file",
"path": "/home/user/Order_Sales_Serial#.xlsx",
"dest": "Order_Sales_Serial#.xlsx"
}
},
"options": {
"rules": [
{
"type": "sheet_data",
"sheet_idx0": 0,
"sheet_idx1": "EI0"
}
]
}
}
}

View File

@@ -63,7 +63,7 @@
"command": [
"libreoffice",
"--convert-to",
"csv:Text - txt - csv (StarCalc):44,34,UTF-8,,,,false,true,true",
"csv:Text - txt - csv (StarCalc):44,34,UTF-8,,,,false,true,true,false,false,1",
"--outdir",
"/home/user",
"/home/user/Set_Decimal_Separator_Dot.xlsx"
@@ -76,11 +76,11 @@
"type": "vm_file",
"path": [
"/home/user/Set_Decimal_Separator_Dot.xlsx",
"/home/user/Set_Decimal_Separator_Dot.csv"
"/home/user/Set_Decimal_Separator_Dot-Sheet1.csv"
],
"dest": [
"Set_Decimal_Separator_Dot.xlsx",
"Set_Decimal_Separator_Dot.csv"
"Set_Decimal_Separator_Dot-Sheet1.csv"
],
"multi": true
},
@@ -92,12 +92,18 @@
],
"dest": [
"Set_Decimal_Separator_Dot_gold.xlsx",
"Set_Decimal_Separator_Dot_gold.csv"
"Set_Decimal_Separator_Dot_gold-Sheet1.csv"
],
"multi": true
},
"options": {
"as_shown": true
"rules": [
{
"type": "sheet_print",
"sheet_idx0": "RNSheet1",
"sheet_idx1": "ENSheet1"
}
]
}
}
}

View File

@@ -62,6 +62,15 @@
"type": "vm_file",
"path": "/home/user/Movie_title_garbage_clean.xlsx",
"dest": "Movie_title_garbage_clean.xlsx"
}
},
"options": {
"rules": [
{
"type": "sheet_data",
"sheet_idx0": 0,
"sheet_idx1": "EI0"
}
]
}
}
}

View File

@@ -1,7 +1,7 @@
{
"id": "aa3a8974-2e85-438b-b29e-a64df44deb4b",
"snapshot": "libreoffice_calc",
"instruction": "Could you help me resizing cells in the sheet so that they fit into just one page and export as pdf file?",
"instruction": "I'm working on a project and need to resize cells in a spreadsheet to fit onto one page and export to PDF for efficient presentation. Could you help me on this?",
"source": "https://www.quora.com/Libre-Office-Calc-How-do-I-resize-all-cells-in-a-sheet-to-make-them-fit-to-1-page-for-printing-and-exporting-as-PDF",
"config": [
{

View File

@@ -62,6 +62,15 @@
"type": "vm_file",
"path": "/home/user/Student_Grades_and_Remarks.xlsx",
"dest": "Student_Grades_and_Remarks.xlsx"
},
"options": {
"rules": [
{
"type": "sheet_data",
"sheet_idx0": 0,
"sheet_idx1": "EI0"
}
]
}
}
}

View File

@@ -62,6 +62,15 @@
"type": "vm_file",
"path": "/home/user/Students_Class_Subject_Marks.xlsx",
"dest": "Students_Class_Subject_Marks.xlsx"
}
},
"options": {
"rules": [
{
"type": "sheet_data",
"sheet_idx0": 0,
"sheet_idx1": "EI0"
}
]
}
}
}

View File

@@ -53,22 +53,32 @@
}
],
"func": "check_data_validations",
"expected": {
"type": "rule",
"options": {
"rules": [
{
"ranges": {
"method": "spreadsheet_range",
"ref": ["D2:D29", "D2:D1048576"]
},
"type": {
"method": "eq",
"ref": "list"
},
"formula1": {
"method": "str_set_eq",
"ref": ["Pass", "Fail", "Held"]
}
"type": "sheet_data",
"sheet_idx0": 0,
"sheet_idx1": "EI0"
},
{
"type": "data_validation",
"sheet_idx": 0,
"dv_props": [
{
"ranges": {
"method": "spreadsheet_range",
"ref": ["D2:D29", "D2:D1048576"]
},
"type": {
"method": "eq",
"ref": "list"
},
"formula1": {
"method": "str_set_eq",
"ref": ["Pass", "Fail", "Held"]
}
}
]
}
]
},
@@ -76,6 +86,11 @@
"type": "vm_file",
"path": "/home/user/Order_Id_Mark_Pass_Fail.xlsx",
"dest": "Order_Id_Mark_Pass_Fail.xlsx"
},
"expected": {
"type": "cloud_file",
"path": "https://drive.usercontent.google.com/download?id=125u7hc0LOcHXtJhOBd_Z5vt__7kwYOTQ&export=download&authuser=0&confirm=t&uuid=17e5da1b-fb1d-45d8-a9b1-6cd146ebaeee&at=APZUnTVqGyk6n5NPKzrq4KSOe871:1705898482101",
"dest": "Order_Id_Mark_Pass_Fail_gold.xlsx"
}
}
}

View File

@@ -62,6 +62,15 @@
"type": "vm_file",
"path": "/home/user/Quarterly_Product_Sales_by_Zone.xlsx",
"dest": "Quarterly_Product_Sales_by_Zone.xlsx"
}
},
"options": {
"rules": [
{
"type": "sheet_data",
"sheet_idx0": 0,
"sheet_idx1": "EI0"
}
]
}
}
}