About Python to add a value to each file name during file conversion

NishimuraChinatsu-9854 756 Reputation points

In the following python in the synapse notebook, I would like to add the letters listed for C2 in excel to each file name when converting files. (C2 + each sheet name)
I can't get the python code to work.

import pandas as pd  
path = "abfss://workspacedfs.core.windows.net/raw/"  
df = pd.read_excel(path+"*.xlsm", [2,3,4] )  
all_sheets = pd.read_excel(excel_file,sheet_name= ['outlet','product','delivery'])  
sheets = all_sheets.keys()  
for sheet_name in sheets:  
     sheet = pd.read_excel(excel_file, sheet_name=sheet_name)  
     sheet.to_csv("abfss://workspace.dfs.core.windows.net/csv/%s.csv" % sheet_name, index=False)
Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,360 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ShaikMaheer-MSFT 37,896 Reputation points Microsoft Employee

    Hi @NishimuraChinatsu-9854 , Thanks for posting query in Microsoft Q&A Platform. Any specific error you are seeing? Kindly share error details.

    Did you tried using openpyxl library to read specific cell value? Check below link about openpyxl library.