Where I have a cell in an .xlsx file that is \"=...\" I want to replace the \"=\" with \'=, so can see the cells as strings rather than as the values.
For example,
As suggested openpyxl solves this problem:
import openpyxl
from openpyxl.utils.cell import get_column_letter
wb = openpyxl.load_workbook('example.xlsx')
wb.sheetnames
sheet = wb["Sheet1"]
amountOfRows = sheet.max_row
amountOfColumns = sheet.max_column
for i in range(amountOfColumns):
for k in range(amountOfRows):
cell = str(sheet[get_column_letter(i+1)+str(k+1)].value)
if( str(cell[0]) == "="):
newCell = "'=,"+cell[1:]
sheet[get_column_letter(i+1)+str(k+1)]=newCell
wb.save('example_copy.xlsx')