How to change cell format to Numeric?

Hello everybody. Possibly a repeating topic, seems to be an easy one, but i cant find the solution.

I need to change cell format in Excel (ex. from General to Numeric) using Dynamo. Any suggestions of which node can help with that? I was trying to find something in Bumblebee, but i failed. Please help. :roll_eyes:

#by Deniz Maral

import clr
import sys
import System
from System import Array
from System.Collections.Generic import *
import time
clr.AddReferenceByName('Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c')
from Microsoft.Office.Interop import Excel
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo("en-US")
from System.Runtime.InteropServices import Marshal
path , c_range = IN		


excel = Excel.ApplicationClass()
wb = excel.Workbooks.Open(path)

excel.Visible = True


wb = excel.Workbooks.Open(path)


ws = wb.ActiveSheet.Range(c_range).Cells.NumberFormat = "0,00"

excel.ActiveWorkbook.Save()
#excel.ActiveWorkbook.Close(True)

#Excel.Application.Quit


OUT= "Success!"
2 Likes

Well, This is absolutely right answer to my question!) Sorry, but i didnt mention one little thing.
I must do it when i am writing excel file. The situation is… I have data as string which writes to excel. But, when excel file is created and data is written, it has General format of cell. So look what happens.

I have this data.
after i have this excel
So you can see it converts to Date. And if i change it to Numeric, i dont get the original data. So… the question is to change it before file created…
P.S. I am using BB Data node from Bumblebee

See if this works for you

1 Like

After creating file get file path and use Passthrough as “wait for” use Node from BumbleeBee and then connect it to my script.

1 Like

That is of course a better solution.

1 Like

Wow, great, Thank you very much! It works!

1 Like

Thank you for your help, anyway! I will might have a use of your script!