How do I save an excel with the current date

Hello

How do I save an excel with the current date?

Tried something like this using the "Start Process

“Date -” + DateTime.Now.ToString (“yyyyMMddHHmmss”) + “. xlsx”

Hi Rodrigo_Buch,

Try this: "ChavesNFE - " + DateTime.Now.ToString("MM_dd_yyyy_HH_mm_ss") + ".xlsx"

Kind Regards
Che

This guide is useful to keep at hand in the future.

While the link is for C#, the format works the same for VB.

Kind Regards

Edit:
@Rodrigo_Buch
I misread your question. If you wish to rename a file, you need to use the Move File activity, with the file path as the source and the destination the file path with edited file name.

For example:
Source: "C:\Test\TestFile.xlsx" Destination (renamed file): "C:\Test\" + "ChavesNFE - " + DateTime.Now.ToString("MM_dd_yyyy_HH_mm_ss") + ".xlsx"

If you are writing a DataTable to an excel file, use the previous for the file name:
"ChavesNFE - " + DateTime.Now.ToString("MM_dd_yyyy_HH_mm_ss") + ".xlsx"

Kind Regards

Those double quotes are wrong. Looks like you copy/pasted from somewhere. They’re not the standard ASCII double quote.

thank you for the help

But nothing just happens!

Use the “Move File” activity if you wish to rename a file with an Activity.

Kind Regards

anything!
This excel file I need to run it always because it has a Macro that takes the names of files in a directory…


In that case of wanting to run a Macro, use the Run Spreadsheet Macro activity.

image

Hi @Rodrigo_Buch
In case if you just want to rename a file within same location

hi nikhil
In my process I need this file because it is called and executes the Macro, after that I just need to save a copy with the current date just to record the information that the macro took.

Hi guys

Thanks for everyone’s help, I managed to solve it as follows:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.