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

Does not support csv

Open
#4 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
9
Forks
4
PR merge metrics
No merged PRs in 30d

Description

`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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.