xxxxxxxxxx
import pandas as pd
# Path to the Excel file
excel_file_path = 'path/to/your/file.xls'
# Read the Excel file into a pandas DataFrame
df = pd.read_excel(excel_file_path)
# Convert DataFrame to JSON
json_data = df.to_json()
# Print the JSON data
print(json_data)
xxxxxxxxxx
import pandas as pd
df = pd.read_excel(r'f.xlsx').to_json()
print(df)
# END
xxxxxxxxxx
import pandas as pd
# Read the Excel file
dataframe = pd.read_excel("example.xlsx")
# Convert to JSON
json_data = dataframe.to_json(orient='records')
print(json_data)