What's wrong with "Excel.WriteToFile"

#1

Hi all,

I’m having issues with the node “Excel.WriteToFile”!
A colleague made a small script to get all parameters from all elements of a given category and push them to excel. But that was for a specific project. So I altered the script a bit because I want to use it again for my current project… yet I get an error on the node “Excel.WriteToFile”.
The message is: “Warning: Excel.WriteToFile operation failed”.
But when I give/mail the script to a colleague that has the same Revit and Dynamo version (we checked that) he can run the script without the warning!!!

Does anybody know what causes the script to fail on my machine??

0 Likes

#2

Do you both have the same version of Excel (and are they both 64-bit)?

0 Likes

#3

sorry, yes. we both use Excel 2016.
Only difference is that my colleague is using Win10 and I’m still on Win7.

He tested my script and it worked on his machine. he altered something tested it…still working. He give the changed file back to me…and it didn’t work on my machine.
But I here more people here that have problems with the standard write to excel node.
So that’s why I asking here.

0 Likes

#4

You are both using Excel 2016, good, but are they both 64-bit?

I’ve heard talk about that it might cause issues if you have a 64-bit operating system and 32-bit excel.

I assume you’ve attempted a system restart? :slight_smile:

0 Likes

#5

We both have the HP Z-book G3 with 64 bits OS. And then Office 2016 is standard 64bits if I’m not misstaken.
But I’ll check with him as soon as he comes back from his meeting.
I haven’t done a restart. Will try that now, because even a simple “1…100…2” range to write to “Sheet1” fails with the standard node.

Going to restart now. :grinning:

0 Likes

#6

One more thing to check on both machines might be the packages installed

0 Likes

#7

That’s a strange thing to do … in my opinion.
It’s a standard dynamo node. So it should work “straight out of the box”.
I also run the script in Dynamo studio… same result: failed.

0 Likes

#8

Could you please upload the script? Last month I have the same problem. But it was because I had l Libre Excel. If you have Microsoft Office, it should work.

0 Likes

#9

Windows 7 may be the issue here. Make sure you are completely updated. However, even that may not work as you’re 2 operating systems (8 and 10) behind and 7 has been out of development for about 3 years, only issuing security patches.

0 Likes

#10

Windows updates are blocked by my company.
the ICT department pushes the updates to everyone at the same time.
So my colleagues have the same updates as me.
and the colleague sitting next to me has the same laptop config as me and he can run the script but I can’t.
I just removed Dynamo…restarted the laptop and reinstalled it … same result!
I feel like I have to remove all Autodesk products and reinstalling them in order to solve this problem. :confounded::confounded::confounded:
I did hoever install DAZ 3D last week and during installation I saw that runtime components and python compenents were being installed/updated.
Don’t know how far that would influence things but all my previous scripts are still working fine. I never used the standard write to excel node before because I had problems with it before.

0 Likes

#11

Colleague isn’t running Windows 10 then?

0 Likes

#12

yes he is. But another colleague is.
The one with Win10 is testing is Win10 is running stable for us. So he’s ahead of us.
In the mean time 3 colleagues have tested the script and on there laptop’s it’s working…
Yet on mine it’s not.
So frustrating!! :tired_face::tired_face::tired_face::tired_face:
And I don’t know what causes this.

0 Likes

#13

Have you updated the office installation on this machine or has it always been 2016? If it’s been updated you may need to clean out some leftover registry issues. See the GITHUB for examples.

0 Likes

#14

hi Jacob,

I removed the “1.8” or “18” (don’t know anymore) from the registry key this morning but that still doesn’t make it work.

0 Likes

#15

Hi everyone,
After 2 days of trying to solve the problem with writing excel Iˇve found that solution in another source.
The problem I think is appeared when the machine doesnt give a permission to specific user to write and open the file.
My error was Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0×80070005 (E_ACCESSDENIED)).
But I also was getting different kinds of errors before, all that I could find in this forum.
And all the solutions was not working for me.
What Ive done is:
1st) goto dcomcnfg
Navigate to Component Services > Computers > My Computer > DCOM Config
Locate the MS application giving you trouble (Microsoft Excel Application)
Right click; Properties
“On the security tab: Select Customize under Launch and Activation Permissions and click Edit…
Add the account under which machine is running, and assign Local Launch; Local Activation permissions;”
BUT because this problem was about website or somthing I didnt get what to add there but Ive found in Microsoft Excel Application Properties the tab Identity
there Ive change the dot from The launching user to The interactive user
This solving was reffering to the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} problem

Next
[COMException (0x800a03ec) error or I belive the alike ones I get before all refered to this solution
"• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open workbook.
Solution:

This seems to be an issue with Excel/Word/etc not having access to a profile when being started via the interop route.
Open Windows Explorer
Depending on whether you installed a 32bit or 64bit version of office you will need to do one (or both) of the following:
32bit Office installation: Navigate to C:\Windows\System32\config\systemprofile
64bit Office installation: Navigate to C:\Windows\SysWOW64\config\systemprofile"

  • Ive found that I havnt any folder systemprofile in this path C:\Windows\SysWOW64
    so Ive create it
    “Verify the folder “Desktop” exists (create it if it’s not there)”
    -as well as Desktop folder
    And thats it
    Now everithing works and writes fine!!!

The original sourse is
https://www.codeproject.com/Questions/274286/microsoft-office-interop-error
Solution 3

I dont know if it ill work on company servers and do people have an access to this config, but there is a few options that I belive can be set up by option This user as you can see below

And yes,
Maybe anyone understands this configs in professional level, who can explain the different ways how to setup this config, and do the topic with solutions for different situations.
Thank you

0 Likes