R
R
RD1706D2022-02-09 11:58:19
Python
RD1706D, 2022-02-09 11:58:19

How to write content of csv file only to specific column in OpenPyXL, Python?

I am writing a program to write CSV content to xlsx in Python, using the openpyxl module I
found a script on the Internet:
import csv
import openpyxl

wb = openpyxl.Workbook()
ws = wb.active

with open('res.csv') as f:
reader = csv .reader(f, delimiter=',')
for row in reader:
ws.append(row)

wb.save('file.xlsx')

however it only writes content to column A1, how to make the column selectable?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question