I have a peculiar situation lets do a background.
Background:
We have a script that was developed in house for testing enterprise servers. The script is written in Bash. The magic of the script is the dmidecode command. The script runs on Linux Mint and is deployed via PXE. The output of the script contains hardware information about the processor, memory, system board and chassis part numbers, etc. This information is always changing depending on the device the image is booted on. All this data is then grepped into a readable format that then manually gets added into an Excel spreadsheet. The Excel sheet is broken up like this Row 1: A1(Asset Number),B1(Qty."always 1"),C1(Manufacturer),D1(Model),E1(Part Number),F1(Serial Number), G1(RAM (Mb)),H1(# of CPUs),L1(CPU Speed(GHZ))
Example Data Column Names:
Column Data: Row 2: 6112, 1, HP, Proliant DL580 G2, 325134-001, USE247ML97, 1024, 2, 2.8
So each row represents an individual server, the columns contain the data that comes from our previously mentioned bash script.
Goal:
OK, so my goal is to have the output of the bash script automatically be appended to an existing Worksheet that is stored on a local CIFS File Server. Since script is initiated on Linux, Powershell is not a viable option. I think Openpyxl can do the job but I have no idea the best practice to approach this. I know that I will not be able to modify an existing workbook. Given that, I was thinking about loading an existing document in memory and overwriting with the same file name. Also, all the tutorials I see for Openpyxl seem to have static data, I do not have this luxury. Is this even possible or just a subtle daydream?
append&scriptingwithpythonandperlas both of these can write Excel files. Try and write 3 lines of Python openpyxl to append a couple of static rows to a simple workbook, then all you need to learn is how to read the output of yourdmidecodeinto Python variables.