aws-samples / aws-samples/sample-rvtools-processor

Does not support csv

Aperta
#4 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
9
Fork
4
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

`openpyxl` doesn't support csv so it needs to be handled separately or simply converted to excel first.

While nothing on github indicates it does support CSV, the [blog post](https://aws.amazon.com/blogs/migration-and-modernization/anonymizing-rvtools-data-for-aws-migration-planning/) does. It would be pretty simple to convert it and save temporary xlsx files to then process.
eg:
```python
import csv
from openpyxl import Workbook

def csv_to_excel(csv_file, excel_file):
wb = Workbook()
ws = wb.active
with open(csv_file, 'r', newline='', encoding='utf-8') as f:
reader = csv.reader(f)
for row in reader:
ws.append(row)
wb.save(excel_file)
```

Currently
```
> python rvtools_processor.py consolidate input1.csv input2.csv -o consolidated.csv

Starting consolidation of 2 files...
Processing: input1.csv
Error processing input1.csv: openpyxl does not support .csv file format, please check you can open it with Excel first. Supported formats are: .xlsx,.xlsm,.xltx,.xltm
Processing: input2.csv
Error processing input2.csv: openpyxl does not support .csv file format, please check you can open it with Excel first. Supported formats are: .xlsx,.xlsm,.xltx,.xltm
Creating consolidated file: input2.csv
Error: At least one sheet must be visible
```

`Python 3.13.3`

```
Package Version
--------------- -----------
openpyxl 3.1.5
pandas 3.0.1
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.