# Importing and exporting files

{% hint style="info" %}
Conversion in both directions uses [Pandoc](https://pandoc.org/). All standard Pandoc limitations apply — complex formatting may not convert exactly. Review your project after importing or exporting.
{% endhint %}

## Importing

You can create a new Overleaf project from a `.docx` or `.md` file.

1. From the project dashboard, select **New Project**.
2. Select **Upload project**.
3. Select your `.docx` or `.md` file.

Overleaf converts the file to LaTeX and opens it as a new project.

<div><figure><picture><source srcset="/files/z7SM3y0vpchawx2g9yxC" media="(prefers-color-scheme: dark)"><img src="/files/62KbsRVJqqEbgTiwmfVU" alt="The &#x22;New Project&#x22; menu showing import options. The option for &#x22;Import Word document&#x22; is selected." width="220"></picture><figcaption></figcaption></figure> <figure><img src="/files/VpTOZzgFxS5gpqr1sxGf" alt="The upload modal prompting the user to select or drag a .docx file. A note along the top says: &#x22;Content will be imported from the selected document. Formatting may not be reproduced exactly.&#x22;" width="375"><figcaption></figcaption></figure></div>

## Exporting

You can download your project as a `.docx` or `.md` file.

1. In the editor, select **File**.
2. Select **Export as Word (.docx)** or **Export as Markdown (.md)**.

The file is saved to your Downloads folder.

<figure><picture><source srcset="/files/OVYQyX1hDFYEfiMdVh7M" media="(prefers-color-scheme: dark)"><img src="/files/f5uGSFKTiopaxZmuKlAO" alt="The open File menu of a project with Download selected. The Download options show &#x22;Export as Word document (.docx)&#x22; selected." width="375"></picture><figcaption></figcaption></figure>

### Before you export: fix your LaTeX errors

The most common reason a conversion fails—especially export to Word—is that the project has unresolved LaTeX errors.

To check for errors, look for a **red notification badge** next to the **Recompile** button. If you see one, your project has compile errors that need to be fixed before a conversion will succeed.

To resolve errors:

1. Select the red badge to open the error log.
2. Select each error to jump to the relevant line in the Code Editor.
3. Fix the error, then recompile.

For help understanding specific error messages, see [Fixing LaTeX errors](https://docs.overleaf.com/troubleshooting-and-support/fixing-latex-errors) and the [LaTeX errors reference](https://www.overleaf.com/learn/latex/Errors). Searching for the exact text of an error message online often finds helpful explanations.

Once all errors are resolved, try the conversion again.

{% hint style="info" %}
Even LaTeX *warnings* can sometimes cause conversion failures. Check the log panel for warnings too, particularly around `\cite` commands and unclosed braces.
{% endhint %}

### What conversions can and can't do

Pandoc is a general-purpose document converter. It understands document *structure*—headings, paragraphs, lists, figures, citations—but it does not recreate visual *styling*. Converting from LaTeX to Word, for example, produces a document with correct structure but without your LaTeX document class, custom packages, or typographic styling.

Think of conversion as a way to share your *content* with collaborators who don't use LaTeX, not as a way to produce a print-ready Word document.

## Common issues and how to address them

<details>

<summary>The conversion fails with an error message</summary>

**What you see:** An error notification appears after you attempt to export or import. The error message may include a description of what went wrong.

**Why it happens:** Pandoc cannot process every valid LaTeX document. Some packages, macros, or document structures are not supported. LaTeX compile errors in the project are also a very common cause.

**What to do:**

1. First, make sure your project has no LaTeX errors (see [Before you export](https://app.gitbook.com/o/gVTOSUMkBnf8EicljJzB/s/VetOkhFZmAC8QCQK0Pi7/~/edit/~/changes/272/managing-projects-and-files/importing-and-exporting-files/~/comments#before-you-convert-fix-your-latex-errors) above).
2. Check the error message shown after the failed conversion for clues about what caused the problem.
3. If the error mentions a specific file not being found (such as a `.bib` file), see Bibliography files in subfolders below.
4. If you cannot resolve the issue, there are alternative conversion tools available:
   * Open the exported PDF in a recent version of Microsoft Word, which can attempt to convert it to .docx.
   * Open the PDF in Adobe Acrobat and use its Export to Word function.
   * Use an online converter such as [GrindEQ](http://www.grindeq.com/) or [CloudConvert](https://cloudconvert.com/).

</details>

<details>

<summary>The exported Word file is missing citations and references</summary>

**What you see:** `\cite` commands in your LaTeX source appear as placeholder text or disappear entirely in the Word output. The bibliography section is missing.

**Why it happens:** Pandoc needs access to your `.bib` file and needs to process bibliography commands to render citations. If the `.bib` file cannot be found, or if the project has bibliography-related errors, citations are dropped.

**What to do:**

* Make sure your project compiles successfully before exporting. A successful PDF compile confirms that bibliography processing is working correctly.
* If your `.bib` file is in a subfolder, see Bibliography files in subfolders below.
* Avoid using `\cite` commands without braces (e.g. write `\cite{key}`, not `\cite key`). The latter may produce only a warning in LaTeX but can break the Pandoc conversion entirely.

</details>

<details>

<summary>Bibliography files in subfolders</summary>

**What you see:** Export fails with an error message containing `File references.bib not found in resource path` (or similar for your own `.bib` filename).

**Why it happens:** Pandoc looks for bibliography files relative to the project root. If your `.bib` file lives in a subfolder, Pandoc cannot find it using a bare filename.

**What to do:**

Update your `\addbibresource` command to include the full relative path to the file. For example, if your `.bib` file is in a folder called `Chapter_1`:

```latex
% Before
\addbibresource{references.bib}

% After
\addbibresource{Chapter_1/references.bib}
```

After making this change, recompile to confirm it still works, then retry the export.

</details>

<details>

<summary>Images are missing from the exported Word file</summary>

**What you see:** Images appear in your Overleaf PDF but are absent or broken in the exported `.docx` file.

**Why it happens:** Pandoc resolves image paths relative to the project root. If images are stored in subfolders, or if your project uses `\graphicspath{}` to set an image directory, Pandoc may not be able to locate them.

**What to do:**

* If possible, move image files to the project root and update your `\includegraphics` commands accordingly.
* If you use `\graphicspath{}`, try removing it and using explicit relative paths in each `\includegraphics` call instead. For example:

```latex
% Instead of \graphicspath{{figures/}} and \includegraphics{my-chart}
\includegraphics{figures/my-chart}
```

* If images are in deeply nested folders, consider restructuring the project to keep files at the top level.

</details>

<details>

<summary>Exported Markdown has broken image paths</summary>

**What you see:** You export your project as Markdown and the image references in the `.md` file point to incorrect paths, so images don't display.

**Why it happens:** When images are stored in subfolders within an Overleaf project, the exported Markdown file may not correctly reflect the relative paths needed to find them.

**What to do:** After exporting, open the `.md` file and manually correct the image paths to match the actual file locations in the exported `.zip`. Alternatively, move your image files to the project root before exporting.

</details>

<details>

<summary>Tables lose formatting in the exported Word file</summary>

**What you see:** Tables in your Word export are missing borders, have broken column widths, or need to be rebuilt from scratch.

**Why it happens:** LaTeX table environments (like `tabular`, `longtable`, and those using packages like `booktabs`) use a richer structural model than Word tables. Pandoc converts the basic structure but cannot replicate all visual styling, borders, or cell-level formatting.

**What to do:**

* For tables that are important for your collaborators to work with, plan to rebuild or reformat them in Word after export.
* Keep table code in your LaTeX source as straightforward as possible. Highly custom tables using advanced packages are less likely to convert cleanly.
* Merged cells and multi-page tables in particular do not convert reliably.

</details>

<details>

<summary>Page formatting isn't preserved when importing from Word</summary>

**What you see:** After importing a Word document into Overleaf, the resulting LaTeX file does not match the original margins, font sizes, line spacing, or page layout.

**Why it happens:** Word's visual page layout is controlled by its own settings (margins, styles, themes), while LaTeX controls layout through document classes and packages. Pandoc converts document *structure* between the two formats, not visual appearance. There is no direct mapping from Word page settings to LaTeX layout commands.

**What to do:**

* After importing, choose a LaTeX document class and add packages (such as `geometry` for margins) to set the layout you need.
* Use the imported `.tex` file as a starting point for your content, not a pixel-for-pixel recreation of the Word document.
* For journal or conference submissions, start from the official template rather than converting from Word.

</details>

<details>

<summary>Custom LaTeX packages and macros aren't converted</summary>

**What you see:** Formatting or content that relies on custom LaTeX packages (such as TikZ diagrams, algorithm listings, or custom-styled boxes) is missing, simplified, or broken in the exported Word file. Custom macros (`\newcommand`) may appear as literal text or be dropped.

**Why it happens:** Pandoc understands a core subset of LaTeX but does not interpret every package or macro. Commands it doesn't recognise are either dropped or passed through as plain text.

**What to do:**

* Diagrams produced by TikZ or similar packages cannot be converted—export the diagram as an image file and include it in your Word document manually.
* If you use custom macros extensively, consider whether the exported Word file is the right tool for your use case. Alternative converters such as [GrindEQ](http://www.grindeq.com/) may handle specific packages better.
* For content that must survive conversion, use standard LaTeX commands where possible.

</details>

<details>

<summary>Heading styles or colours change after export</summary>

**What you see:** Section headings appear in a different colour or style in the exported Word document compared to your Overleaf output.

**Why it happens:** LaTeX heading appearance is controlled by your document class or packages like `titlesec`. Pandoc maps LaTeX headings to Word's built-in heading styles (Heading 1, Heading 2, etc.), which carry Word's own default styling. Custom colours or formatting applied via LaTeX packages are not preserved.

**What to do:** After exporting, apply your preferred styling to Word's heading styles directly. Changes to a heading style in Word apply to all headings at that level throughout the document.

</details>

<details>

<summary>Emojis in a Markdown file cause import problems</summary>

**What you see:** After importing a `.md` file that contains emoji characters, the resulting `.tex` file appears non-editable in Overleaf.

**Why it happens:** Emoji characters are outside the standard character set that LaTeX handles by default, and can produce encoding errors that affect the file.

**What to do:** Remove emoji characters from your Markdown file before importing, then retry.

</details>

<details>

<summary>The conversion times out or fails on a large project</summary>

**What you see:** The conversion spinner runs for a long time and then shows a "something went wrong" error, or you receive a timeout message.

**Why it happens:** Conversions have a file size limit (files over 50MB cannot be converted) and a time limit. Very large projects, projects with many images, or documents that generate complex output can exceed these limits.

**What to do:**

* Check that your project is under 50MB total.
* If your project is large, try exporting the main `.tex` file only rather than the whole project.
* Remove any large or unused files from the project before attempting conversion.

</details>

<details>

<summary>The round-trip workflow (LaTeX → Word → LaTeX) loses formatting</summary>

**What you see:** You export to Word for a collaborator to edit, re-import the revised file, and find that custom styling, typefaces, and table formatting have been lost. There is no `.sty` file in the imported project.

**Why it happens:** Each conversion in the round-trip loses information that cannot be recovered. The LaTeX-to-Word conversion loses package styling; the Word-to-LaTeX conversion has no way to reconstruct it. There is no stylesheet or `.sty` file that carries over between formats.

**What to do:** The round-trip workflow works best for plain text content edits (corrections, additions, rewrites) rather than structural or design changes. After re-importing:

* Reapply your preamble, packages, and document class from your original project.
* Rebuild any tables or figures that need to match your original layout.
* Consider using [Track Changes](https://www.overleaf.com/learn/latex/Track_Changes_in_Overleaf) or sharing the project directly with collaborators as an alternative to round-tripping through Word.

</details>

### If you're still stuck

If a conversion fails and none of the above steps resolve it, contact [Overleaf Support](https://www.overleaf.com/contact). It helps to include:

* The URL of your Overleaf project (if you're comfortable sharing it)
* The full error message shown after the failed conversion
* A description of what you were trying to do (export to Word, import from Markdown, etc.)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.overleaf.com/managing-projects-and-files/importing-and-exporting-files.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
