Aug-29-2024, 04:49 PM
(This post was last modified: Aug-29-2024, 06:22 PM by deanhystad.)
Hi team,
Today i just joined the forum and like to seek your experties . i am trying to convert Xls files in the on premises SharePoint in our company to Csv ,
i have below code so far can some one help me to make this work for some reason it is not working for me i know the code below is not completed
Today i just joined the forum and like to seek your experties . i am trying to convert Xls files in the on premises SharePoint in our company to Csv ,
i have below code so far can some one help me to make this work for some reason it is not working for me i know the code below is not completed
import pandas as pd import os import glob # Replace the folder_url with the SharePoint URL of the document folder folder_url = 'https://company.sharepoint.com/:f:/s/Source/ErzWHfGHqWxAt_G0F09schwBN8Heo9khieMVLKbG0jbLzQ' # Get a list of all XLS files in the folder xls_files = glob.glob(f'{folder_url}/*.xls') # Iterate over each XLS file and convert it to CSV for xls_file in xls_files: # Read the XLS file using pandas df = pd.read_excel(xls_file) # Get the filename without the extension filename = os.path.splitext(os.path.basename(xls_file))[0] # Replace the output_folder_path with the desired path for the CSV files output_folder_path = 'https://company.sharepoint.com/:f:/s/Source/ErzWHfGHqWxAt_G0F09schwBN8Heo9khieMVLKbG0jbLzQ ' # Create the output folder if it doesn't exist os.makedirs(output_folder_path, exist_ok=True) # Convert the DataFrame to CSV csv_file_path = f'{output_folder_path}/{filename}.csv' df.to_csv(csv_file_path, index=False) print(f'File converted and saved as {csv_file_path}')Thanks & lookin for your help

deanhystad write Aug-29-2024, 06:22 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button