Export Part of spreadsheet to csv
Is it possible to export part of a spreadsheet to csv (or any other format) please?
MacBook Pro 13″, macOS 12.2
Apple Intelligence is now available on iPhone, iPad, and Mac!
Is it possible to export part of a spreadsheet to csv (or any other format) please?
MacBook Pro 13″, macOS 12.2
gerrynuk wrote:
I'll have a look at the AppleScript
If you're on Monterey on the Mac or on iOS then the Shortcuts App allows you to do this much more easily than with an AppleScript.
Launch Shortcuts and drag in a Get Clipboard, Set variable, Replace and Copy actions and set up as shown, making sure Regular Expression is checked:
Then select the relevant cells in your table and command-c to copy to the clipboard.
Click the triangle run button in Shortcuts.
Click wherever you want and command-v to paste the results. I clicked in a text box beneath the original table and pasted, giving this:
You can tell Shortcuts App to save the results as a file if that is easier than pasting.
You can give your Shortcut a name and save it for reuse. Via the File menu in Shortcuts App you can even add it to the Dock if you want for easy access.
SG
(P.S. Forgive typos resulting in misspelling of Stalbridge and Hertfordshire).
gerrynuk wrote:
I'll have a look at the AppleScript
If you're on Monterey on the Mac or on iOS then the Shortcuts App allows you to do this much more easily than with an AppleScript.
Launch Shortcuts and drag in a Get Clipboard, Set variable, Replace and Copy actions and set up as shown, making sure Regular Expression is checked:
Then select the relevant cells in your table and command-c to copy to the clipboard.
Click the triangle run button in Shortcuts.
Click wherever you want and command-v to paste the results. I clicked in a text box beneath the original table and pasted, giving this:
You can tell Shortcuts App to save the results as a file if that is easier than pasting.
You can give your Shortcut a name and save it for reuse. Via the File menu in Shortcuts App you can even add it to the Dock if you want for easy access.
SG
(P.S. Forgive typos resulting in misspelling of Stalbridge and Hertfordshire).
Given that you are talking exporting to CSV, I will assume "part of a spreadsheet" means a single table or part of a table.
If you create a truly blank document and save it as a template you use that template each time and skip step 4.
If you want an entire sheet including tables, charts, shapes, etc., then select all those elements in step 1. Formulas that reference cells on other sheets will be replaced with their latest value. Charts that reference values on other sheets will create their own tables.
If "any other format" includes PDF, whatever you can print to paper you can print to PDF instead. So you can create a PDF of a single page that has whatever you have put on it.
Thanks, Badunit. I'm using the spreadsheet as a template for recording family history data. The destination is a free-form text page and the data needs to look something like this, with the template supplying the headings:
If I do a simple cut and paste from the spreadsheet to the free-form text it is saved as an image of the spreadsheet table. So I need a simple way to get the data into CSV format, as above. For some reason it doesn't seem to be possible to export either a single Table or part of a Table in a multi-table spreadsheet.
Your series of steps would work but would be fiddly and time-consuming for the large number of entries needed but I may be able to reduce the number steps required if the spreadsheet has only have one record at a time.
So thanks for your help.
gerrynuk wrote:
it pastes with the grid or tabs, depending on the destination
Yes it is CSV (character separated values) with tab as the delimiter. Many apps can accept that. You can also paste into TextEdit and Find-Replace tab with , or ; or whatever other delimiter the destination requires.
SG
Copy/paste to something like textedit then find/replace the tabs works unless the data has a tab character or a comma in it. Tab may be uncommon but lots of numbers have commas, as does text.
EDIT: but would work fine for the data that was just posted.
Now that I see you data, SGIII's idea ought to work. If you paste into a plain text TextEdit document it will paste as tab separated. You can set TextEdit so it defaults to plain text (in TextEdit Preferences) so you don't have to change from rich to plain each time. Then find/replace the tabs with commas.
There is also an AppleScript that converts the clipboard to text. Then you can skip TextEdit and paste directly into your document then find/replace the tabs there. Or an AppleScript could be written to convert it to text and find/replace tabs so all you would have to do is paste the results. I don't have time to work on it now.
Hi Badunit. There won't be any tabbed data and I'm exporting as CSV so I wouldn't need to do a search/replace to change tabs to something else but I'll have a look at the AppleScript to see if it will shorten the process.
Also consider this: just select the part you want, and copy-paste to wherever you want, skipping the save to file part.
SG
Thanks, SGlll. I have already tried that but it pastes with the grid or tabs, depending on the destination, which is not what I want.
Badunit: Commas aren't a problem for what I'm trying to achieve and there won't be a tabbed data so that seems to be the way forward.
SG: Thanks.
That does just what I want. Many thanks.
Export Part of spreadsheet to csv