excelpaste

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 5.3, Creation date: 2023-02-23, Last change: 2025-08-19

converts the content of the clipboard for a multi line insert/past into EXCEL on MAC

Description

Some law companyies use excel to structure question list. The anwsers to those questions are typically much longer than the questions itself and require multi paragraph text. htis is not possible without Quotation marks. Therefor use on OSX the following procedure:
1) write the multi paragraph ytex in a text editor
2) Copy the content by CMD-C in the clipboard
3) open matlab and cann this function excelpaste
4) Goto Excel and insert the clipbord by cmd-V


See Also:

Example Illustration

 missing image of excelpaste

Syntax

excelpaste




Copyright 2023-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This algorithm is designed to facilitate the insertion of multi-paragraph text into Excel on macOS. It is particularly useful when dealing with text that requires quotation marks for proper formatting in Excel.

Input Parameters

The function does not take any input parameters directly from the user. It operates on the content currently stored in the clipboard.

Algorithm Steps

  1. Retrieve the current content of the clipboard using the command txt=clipboard('paste').
  2. Check if the text in the clipboard starts with a quotation mark using if ~startsWith(txt,'"').
  3. If the text does not start with a quotation mark, proceed to the next steps:
    1. Replace any existing quotation marks in the text with double quotation marks. This is done using the function strrepn(txt,'"','""',newline,[char(13) char(10)]). This ensures that any internal quotation marks are properly escaped for Excel.
    2. Enclose the entire text in quotation marks by concatenating '"' at the beginning and end of the text. This is achieved with nxt=['"' nxt '"'].
    3. Copy the modified text back to the clipboard using clipboard('copy',nxt).
  4. If the text already starts with a quotation mark, no changes are made, and the function ends.

Output

The function does not return any output to the user. Instead, it modifies the clipboard content, which can then be pasted into Excel using the standard paste command (CMD-V).

Additional Information

This function is part of the SolidGeometry library and was introduced in version 5.3. It is designed to work on macOS systems where Excel requires text to be properly formatted with quotation marks for multi-line entries.

Algorithm explaination created using ChatGPT on 2025-08-19 00:13. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21