This repository contains a helper application for the main CO-PO-Attainment-Generator app. It's designed to handle specific operations like updating cells and inserting columns in Excel files, providing essential functionality to the main application.
This helper app is meant to be used in conjunction with the main CO-PO-Generator app. It takes a JSON string as input, which specifies the operations to perform on the Excel file.
The JSON string (as given by struct_operation.go) should be in the following format:
{
"type": "updateCells",
"sheet": "Sheet1",
"column": "A",
"count": 3,
"mappings": {
"A1": "New Value"
}
}Each operation object should have the following properties:
type: The type of operation. Supported types areupdateCells,removeColumn,insertColumn,hideColumn,showColumn,hideSheet, andshowSheet.sheet: The name of the sheet on which to perform the operation.column: The name of the column for column-specific operations. This is optional and not needed forupdateCells,hideSheet, andshowSheetoperations.count: The number of times to perform the operation. This is optional and not needed forupdateCells,hideSheet, andshowSheetoperations.mappings: A map of cell addresses to values for theupdateCellsoperation. This is optional and not needed for other operations.
The program supports the following command-line flags:
-v: Select the variant (v1orv2).v1uses the excelize package by xuriv2uses the xlsx package by tealeg
-op: Operations to perform on the excel sheet in JSON string format.- This is the operations object mentioned in the usage section.
-i: Input Excel file path.-o: Output Excel file path.
Here are a few examples of how to use the application:
-
To perform operations specified in a JSON string:
go run main.go -v v1 -op '[{"type": "updateCells", "sheet": "START", "mappings": {"C06": "Test", "C07": "Test Position"}}]' -i input.xlsx -o output.xlsx -
To perform operations specified in a file:
go run main.go -v v1 -op "$(cat operations.json)" -i input.xlsx -o output.xlsx -
To use the test operations for debugging:
go run main.go -v v1 -op test -i input.xlsx -o output.xlsx