Import Text to Sketch

Hi all,

Can I Import a .txt file into a sketch? reason being ,in a txt I can copy & paste, which is quicker than typing every line, in a sketch I can't copy & paste.Using lastest version of Arduino Editor.


I can't copy & paste.Using lastest version of Arduino Editor.

Please explain what you mean by that. What version are you using ?

... in a sketch I can't copy & paste.Using lastest version of Arduino Editor.

News to me.
Sometime using CTRL+C to copy and CTRL+V to paste (CTRL+X to cut) works better than the mouse clicks.

Copy/Paste work normally in sketches for me. I couldn't stand developing without it...

Are you saying Ctrl+C and Ctrl+V don't work for you in the Arduino IDE?

(in any event, you can edit the .ino file with any text editor; but you should be able to use the IDE without issues)

I also think that your copy paste issue needs to be investigated and resolved. However, to answer your question: Sketch files are text files, they just have a different file extension. You can simply open a sketch file in a text editor and edit it. Some people like to use a different text editor from the one that is part of the Arduino IDE. There is even a feature of the standard IDE (not the Arduino Web Editor), File > Preferences > Use External Editor. That will allow you to have the sketch open in the Arduino IDE to use for compiling and uploading while you edit it in the text editor of your choice.

Be sure to use a text editor program that is suitable for programming. Under no circumstances should you use Windows Notepad, Wordpad, Microsoft Word, or similar programs. My personal preference is notepad++ but there are many other excellent options.

Yes , Ctrl C & v worked . I have only ever used the mouse before. Thanks for the useful information.


Ah, I see now, you must be using the Arduino Web Editor. For some reason the right click copy paste doesn't use the standard clipboard. So you can only copy and paste stuff within the Arduino Web Editor. That's pretty annoying but really using the right click menu is so much slower than the keyboard shortcuts anyway and they use the standard clipboard.

I actually prefer to use Ctrl+Insert and Shift+Insert over Ctrl+C and Ctrl+V but I think I'm probably the only one.