Change the name of an Excel Worksheet

I have a file that I download automatically every day. I want to copy the data from this file to another already existing file. This normally works when I use “ReadExcel” and “WriteExcel”.

The problem is that the sheet name on the downloaded file starts with a number, which results in this error on the “WriteExcel” step:

The table name ‘1 example’ does not begin with a letter, an underscore or a backslash.

Is it possible to change the name of the excel sheet or change the name of the dataset?

Thanks in advance!

i’m pretty sure you can also reference a sheets by index.
So try reference it using (0) instead of (“1”)

I’m not really sure what you mean by this, the name of the sheet on the
downloaded file is this:
image

I then use ReadExcel and WriteExcel:
image

ReadExcel:
image

WriteExcel:
image

This results in the following error:
The table name ‘5000 Beach’ does not begin with a letter, an underscore or a backslash.

What should I change to fix this?

oh … yeah, that is a problem.
I cannot “fix it” and allow for names that does not comply with that rule, since it’s done by the nuget package i used.
A work around could be to loop over each table and ensure the names comply with that rule

But before we try that, if all you are doing is copying all the data from one sheet to the other, why do you not just copy the file ? ( with file.copy inside a Invoke Code )

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