Jump to content

Why does Excel add "%20" as spaces in file naming?


---
 Share

Recommended Posts

I am creating an Excel file from Calypso via the Characteristic.xlt file.
I am running into an issue where there is a space between words/Letters/etc; Excel adds "%20" in place of the "space".

The "PCM" scripts are not creating a string with "%20", its only when the string is passed to Excel.

Example file naming:
Ruby Head_Rev 2_Op 70_M0070-Test4_DeleteMe_2023-7-12_85844 am.xls
Becomes:
Ruby%20Head_Rev%202_Op%2070_M0070-Test4_DeleteMe_2023-7-12_85844%20am.xls
When I save the file the "%20" stays in the file name, or I have to manually edit the file name.

This is not happening on all installs of Excel.

Any help is appreciated.

Excell adds percent20 for spaces.JPG

Link to comment
Share on other sites

Not sure if this helps, but I did find a post on Microsoft's forums. https://answers.microsoft.com/en-us/mso ... 0to%20%20.

Looks like it boils down to the version of Excel you're using and/or if the file is being saved over a network connection instead of directly to the PC. The character replacement is due to URL naming convention, as spaces are considered unsafe ASCII characters. It sounds like you should be able to run an older version of Excel (before Dec 2022) to bypass the issue or you'll need to modify the naming convention of your output files without using spaces.

Hope you get it working again!
Link to comment
Share on other sites

Please sign in to view this quote.

.

Per ChatGPT:

.

The issue you're encountering with Excel adding "%20" in place of spaces in the file names is likely due to URL encoding. In URLs, spaces are represented as "%20" to ensure compatibility with web browsers and other software.

To resolve this issue, you can try the following solutions:

1. Manually remove "%20" from the file names:
After saving the Excel file, you can rename it by removing "%20" and replacing them with spaces. This can be done by right-clicking the file, selecting "Rename," and editing the name accordingly.

2. Use a different character in place of spaces:
Instead of using spaces in the file names, you can use underscores (_) or dashes (-) as separators. For example, "Ruby Head_Rev 2_Op 70_M0070-Test4_DeleteMe_2023-7-12_85844 am.xls" could be renamed to "Ruby_Head_Rev_2_Op_70_M0070-Test4_DeleteMe_2023-7-12_85844_am.xls". This avoids the need for URL encoding.

3. Check Excel settings:
Verify the settings in Excel to ensure that the encoding is not being automatically applied. Look for any options related to URL encoding or character replacement. These settings can vary depending on the version of Excel you are using.

4. Use VBA or a macro to automate renaming:
If you frequently encounter this issue, you can consider using Visual Basic for Applications (VBA) or a macro to automatically rename the files after they are generated. You can write a script to replace "%20" with spaces or any other desired character.

It's worth noting that the behavior you described may be specific to certain installations of Excel due to different settings or configurations. Therefore, it's important to check the Excel settings on the affected installations and compare them with the ones where the issue is not occurring.
Link to comment
Share on other sites

Please sign in to view this quote.

The limitations of an AI.....

If you know for sure such an option exists, then NAME IT!!
If you don't know, better hold your tongue 🙄
Link to comment
Share on other sites

Please sign in to view this quote.

I have.

Calypso is a hard limitation due to how a measurement plan is created, but DMIS is certainly possible.
Link to comment
Share on other sites

Please sign in to view this quote.

Or...
Remove a hidden network drive allocation within Calypso....
That was the issue.
One particular new install had a drive designation missing for a network location. It allowed Excel to generate a filename without "%20".
System settings:
Environment:
Paths, under "Default path for Result Files.
The offending CMM has a drive designation for a Network drive.
Removing the network drive and Excel generates a normal filename as planned on a local location.

Thanks to all who participated.
Link to comment
Share on other sites

Please sign in to view this quote.

Please sign in to view this quote.

Please sign in to view this quote.

Please sign in to view this quote.

Please sign in to view this quote.

.

Rick, I'm glad you figured this out. I would've never guessed that the problem was caused by a drive allocation. You're an excellent critical thinker.

ChatGPT does have limitations. It often laces its responses with false info. What excites me about AI is not what it can do today but what it is becoming. I use it for text and code generation for things like responding to emails, writing .bat scripts etc..

In a year or two, AI may be able to draft measurement plans in Calypso's native format, but a human would still need to audit them. A standalone AI bot for metrology is not likely in the near future.

But just in case, be polite to your future overlords:


.
4532_74c4855ad927b58d768b3fbc70166ce0.jpg
.
Link to comment
Share on other sites

Please sign in to view this quote.

Oh, is that GLaDOS on the right?
I 'd like to take this opportunity to express my thanks for the delicious cake!
Oh, and never mind the potato.
Link to comment
Share on other sites

 Share

×
×
  • Create New...