I'm using Walmart template file to upload bulk listings to their site. The template only allow 10.000 rows, so I have to split them into multiple files. The solution I'm using is to copy the original xlsx file and use new name for the file.
Here's the code for copying file
newWMFile = 'c:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python312\\'+'walmart-test-save.xlsx'
shutil.copyfile('c:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python312\\walmart.xlsx', newWMFile)
I try to open the new file using openpyxl and just save the file without any changes.
After I ran the code, I open the xlsx file, everything looks the same when viewing it with Excel program, but when I uploaded it to Walmart, it said something wrong with the file. After checking, I found out that the headers were modified somehow, I only knew this when I tried to copy the header "SKU" which is a merged cell, and pasted into text editor.
The SKU header of the original file from Walmart, in sheet "Product Content And Site Exp" looks like this:
SKU
SKU
while the file after saving using openpyxl looks like this:
SKU
There's a missing SKU as you can see.
Here's link to the 2 files:
Original working file:
;ouid=117184241470804778107&rtpof=true&sd=true
Corrupted file after saving using openpyxl: ;ouid=117184241470804778107&rtpof=true&sd=true
And here's the code that I'm using:
code
workbook = load_workbook(newWMFile)
worksheet = workbook.active
workbook.save(newWMFile)
workbook.close()
code