question

rajashekar-9484 avatar image
0 Votes"
rajashekar-9484 asked David-9140 Suspended commented

Convert Microsoft Excel file to text file

Hi,

I have a requirement from our customers to convert excel files to text files. I was provided with a PowerShell script to convert excel to text to be run every day. When I run the script from PowerShell the script runs as expected converts excel files to text files but when I schedule and run it through task scheduler it is erroring with the below log,

Microsoft Excel cannot access the file 'E:\Test_reports\PaymentWarehouse\test\ETPAY-en_2021-07-21T092301719Z.xlsx'.
There are several possible reasons:
• 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.\n


Please let me know if anyone got an idea,

Thanks







office-excel-itpro
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

You could probably try Spire.XLS for .NET to convert excel to text. It does not require MS Office to be installed on machines.


0 Votes 0 ·
rajashekar-9484 avatar image
0 Votes"
rajashekar-9484 answered rajashekar-9484 commented

I tried creating the Desktop folder in the path mentioned, it did not work.

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@rajashekar-9484,
Thanks for your reply.

Please provide the detailed version of Office. It is recommended to update your Office to the latest version first.

Then please check if there is the issue with using PowerShell script to convert other files, you can also try it on another PC.

  • If all files have this issue.
    I suggest you refer to the steps in this document to convert Excel files to text files.

  • If only a specific file has this issue.
    Is E:\Test_reports\PaymentWarehouse\test the path where the file is stored? Please try the following steps to check this issue.

  1. Try to move to another location.

  2. Rename it.

  3. Copy the file to another PC.

Any updates, please let me know.

0 Votes 0 ·

Windows Server 2012 R2,
Microsoft office is Professional 2016 (16.0.5149.1000) MSO(16.0.5149.1000) 64-bit.

I tested the script on Windows 10 machine with Office 365 license and the script was running ok on the task scheduler as expected.

0 Votes 0 ·

@rajashekar-9484,
Thanks for your reply and sharing.

In this thread, tntng resolved this issue by modifying the folder C:\windows\SysWOW64\config and sub folder C:\windows\SysWOW64\config\systemprofile to allow permissions to the service account in the Security tab.

If this issue persists, I would suggest you open a paid ticket to help you test remotely and further analyze this issue.
Thanks for your understanding!

0 Votes 0 ·
Show more comments
VikiJi-MSFT avatar image
0 Votes"
VikiJi-MSFT answered

@rajashekar-9484,

Which version of Office are you using?

Per my research, please create the following folder and add full control permissions for the relevant users.

  • For 64-bit Windows:
    C:\Windows\SysWOW64\config\systemprofile\Desktop

  • For 32-bit Windows:
    C:\Windows\System32\config\systemprofile\Desktop

For more information, please refer to the method in this similar thread.
Please note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.

Hope the information is helpful to you.


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.