Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 16478

is it possible to split data while moving it from one excel file to another in python? Pandas or openpyxl

$
0
0

Essentially I need to translate one excel document into another.

Both sheets are formatted differently, but contain most of the same information - however in sheet 1, some data is formatted in a different way.

For Example "Name" in Sheet 1, and "First Name" "Last Name" in Sheet 2

is it possible to have my script do this for me? What about looking for seperators like a comma to split "Address" into "Street" "city" "state" "zip" -- or is that best done post-translate using Excel tools.

I've been able to read rows directly using openpyxl with code like this:

    step = 2    read_start_row = 4    write_start_row = 3    amount_of_rows = 30    for i in range(0, amount_of_rows, step):        #copy from wb1        c = ws1.cell(row=read_start_row+i, column=4)        #paste in ws2        ws2.cell(row=write_start_row+(i/step), column=4, value=c.value)

but not sure where to start when trying to also alter the data.


Viewing all articles
Browse latest Browse all 16478

Trending Articles