问题
I'm exporting a spreadsheet from Google Docs as CSV, and there are apostrophe's (') prepended to each date and time value. This is really annoying as OpenOffice doesn't seem to be able to find/replace these in the spreadsheet editor.
I could solve the problem by opening the CSV file as text and replacing the chars that way, but it seems like there has to be a way to prevent the issue in the first place. Anyone know of a way to fix this? (Removing them during the OO file import would also be an acceptable solution.)
回答1:
The apostrophe isn't really part of the cell content, it just signifies that the cell is formatted as text. To reenter all the data as number:
Highlight all of the cells and use Format -> Cells to change the cell format to an appropriate number format.
With all of the cells still selected, go to the menu Edit -> Find & Replace
In the Search For box enter .* (period asterisk)
In the Replace with box enter &
Select More Options and check Current Selection Only and Regular Expressions
Click Replace All
The .* "means zero or more of any character" and & means "whatever was found". These are regular expressions which are explained in the help section
Source
回答2:
It turns out the the CSV file itself didn't have the apostrophes in the data, but they were being added by OpenOffice Calc during the import. Checking the selection marked "Detect special numbers" prevented this modification, but then converted the values to specific formatting that can be handled within the Spreadsheet view. Still not an ideal solution, but clearly the issue centers on OpenOffice Calc rather than Google Docs.
来源:https://stackoverflow.com/questions/14186580/google-docs-spreadsheet-export-how-to-remove-apostrophe-from-times-dates