How to Retain Excel Formula when running script on it

I just wrote a python script that takes an input csv, and outputs a new csv that has an extra column and does some stuff to the rows in the original file. Three of the columns in the input file had formulas, but it looks like the output file just takes the value that was in those columns, not the formula.

Is there a way to write my program such that the formula is written to the output, and not simply the value that is there?

Answers


When you convert your workbook to a CSV the formulas are not saved. Displayed values are saved in CSVs, not the formulas themselves.

If you want your formulas to be saved in the CSV, you will need have the cell show the formula itself instead of the value. You can do this by adding a ' to the beginning of the cell to indicate it should be treated as text.

In other words, this issue is caused before Python even starts reading your input CSV. The issue is created when you make the CSV.


Need Your Help

Can I set PHP's Interal Date and Time to months before?

php time

I am wondering if I can change PHP's overall date, to think its really at about 2 months ago, or 2011 if I want.

How to set error notifications in FuelPHP

php error-handling fuelphp

I have a problem when I want to publish my local development to production environment,

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.