2 Ways to Export Code on Google Gemini

What to know

  • You can export code from Gemini using the Share icon under the generated response.
  • Codes can be exported to Colab and Replit, or can simply be copied to clipboard.
  • You can import code from a GitHub repo or by pasting it inside the prompt box.

In addition to letting you add images to prompts and sharing chats, Google offers a share button inside Gemini to let you export your Python code to code environments such as Colab and Replit. This guide will focus on how to import and export code on Google Gemini. Let’s get started. 

How to export code on Google Gemini [2 methods]

Now, let’s say you’ve been working on a code with the help of Google Gemini and want to export it. Gemini now provides a few ways to do that too. Here’s how: 

Method 1: Export code to Colab and Replit

  1. To start sharing, go to the bottom of Gemini’s response and click on the share icon (before ‘Google it’).
  2. Here, you’ll have the following options: Export to Colab and Export to Replit
  3. Click on Export to Colab to do so.
  4. Once the Colab notebook is created and saved to Drive, click on Open Colab at the bottom left corner.
  5. The Python code will open in a new Colab notebook. 
  6. To Export to Replit, select that option instead.
  7. Select I understand, open Replit from the notification.
  8. You may have to authorize Replit to use.
  9. Once it opens, you’ll see your code appear in Replit.

Method 2: By copy-pasting code

Users also have the option of simply copying the code generated in the Gemini response.

  1. Click on the Copy icon at the bottom right corner of the generated code.
  2. Once copied, you can paste and use the code wherever you like. 

How to import code on Google Gemini

Though it has yet to reach the level of code editors that support direct file sharing such as VS studio code, Atom, Eclipse, etc., you can still transfer code to Google Gemini in a few ways.

  1. If you have a code file saved on your computer, transfer it to Google Drive or Dropbox and right-click on it to get its link.
  2. Then paste the link in your prompt and import the code. 
  3. Or if you have it open on a code editor already, you can simply copy the code and paste it in the prompt. 
  4. Gemini will then go on to describe the steps in the code. You can ask it further questions relating to the code, run corrections, and use Gemini to interact with it.

FAQ

Let’s take a look at a few commonly asked questions about coding on Gemini.

Can Google Gemini write code?

Yes, Google Gemini can generate code in 20 programming languages. Though it is far from perfect, it is a viable tool for anyone learning to code or users who just want to get pre-written code for their use.

What languages can Gemini code in?

Google Gemini can write code in such programming languages as C++, Java, Javascript, Python, Typescript, Go, and more. 

Can you upload files to Gemini AI?

Yes, you can upload JPEG, PNG, and WebP files to Gemini. This makes Gemini the first AI chatbot to be able to do so.

Thanks to the new updates, Gemini’s capabilities are improving fast, making it faster, more efficient, and more user-friendly. We hope you found this guide helpful. Until next time!