I use a script that converts a xls file with formula in some cells to a xlsx file. The Problem is that the cells which had formula are now displayed as "0" in the xlsx file.
Is there a way to get rid of formula and get only the value instead? Couldn't find a solution in different threads yet. Also I have no experience with openpyxl which are a lot referring to in this case
import os
import re
import pandas as pd
import glob
import time
import xlwt
def setwd():
from pathlib import Path
import os
global home
global save_dir
home = str(Path.home())
os.chdir(home + r'\...\...\Staffing Report\Input\MyScheduling\Raw_Data')
latest = home + r'\...\Staffing Report\Input\MyScheduling\Raw_Data'
folders = next(os.walk(latest))[1]
creation_times = [(folder, os.path.getctime(folder)) for folder in folders]
creation_times.sort(key=lambda x: x[1])
most_recent = creation_times[-1][0]
print('test' + most_recent)
os.chdir(latest + '\\' + most_recent + '\\')
print('current cwd is: ' + os.getcwd())
save_dir = home + '\...\Input\MyScheduling\PBI\\' + 'Individual_Status.xlsx'
return save_dir
def rowdrop():
global df
global fdt
einlesen = os.getcwd()
print('test einlesen: ' + einlesen)
df = pd.read_excel('Individual Status.xls', sheet_name = 'Individual Status Raw Data')
df = df.iloc[6:]
df = df.rename(columns=df.iloc[0]).drop(df.index[0])
fdt = pd.read_excel('Forecast Detail and Totals.xls', sheet_name = 'Forecast',)
fdt = fdt.iloc[0:]
#fdt = fdt.drop(['Code'],axis=1)
os.chdir(home + '\...\Input\MyScheduling\PBI')
print('Current CWD before export is: ' + os.getcwd())
df.to_excel('Individual Status.xlsx', index = False)
fdt.to_excel('Forecast Detail and Totals.xlsx', index = False)
return df
#main
setwd()
rowdrop()