> For the complete documentation index, see [llms.txt](https://docs.geopard.tech/geopard-tutorials/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.geopard.tech/geopard-tutorials/gis-quick-hints/qgis-change-string-to-number-values-in-the-shapefile.md).

# QGIS: Change String to Number values in the shapefile

In QGIS, you can convert a string to a number using the "Field Calculator" tool. First, open the attribute table for the layer you wish to modify. Next, click the "Open Field Calculator" button. In the "Expression" box, type "to\_real(" followed by the name of the field containing the string you want to convert, and closing parenthesis. For example, to convert a string field named "string\_field" to a numeric field, input "to\_real("string\_field")" in the Expression box. You can also modify the output field name and data type by selecting the appropriate options. Finally, click "OK" to complete the conversion. The original string field will remain in the attribute table, while the new numeric field will be added to the table.

<figure><img src="/files/NXxlWtob7w7Bd1gSDKtF" alt=""><figcaption></figcaption></figure>

1. Open "Properties"
2. Go to "Field Calculator"
3. Check "Update Existing field"
4. to\_real("attributeName")
5. Save edits
6. Repeat the same for each attribute

   <figure><img src="/files/IH0SnGCfaNnnZsH73Kum" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.geopard.tech/geopard-tutorials/gis-quick-hints/qgis-change-string-to-number-values-in-the-shapefile.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
