Q:

Rename multiple files using a list of names on excel

I have a bunch of PDF files with random names, like 95456356.pdf, 7896548965.pdf and so on. I also have a list of names in an Excel file with all the names in a column. Can I write a code that would read that Excel file and then rename all PDF files in the same order, like the first file would be renamed to the name in the fisrt row in the excel file? I can copy and paste that column to a .txt file if that makes it easier.

A:

You used the xlrd package to read your Excel file. A nice tutorial on how to read Excel files can be found here: https://www.geeksforgeeks.org/reading-excel-file-using-python/
With this package it should be relatively easy to write code with the desired behaviour:

You should be able to read one cell with the name you want to use for renaming the files
You should be able to read the filenames of the pdf files
You should be able to rename files using the os package (see here: How to rename a file using Python)

