# QGIS: Cambiar valores de texto a número en el shapefile

En QGIS, puedes convertir una cadena de texto en un número usando la herramienta "Calculadora de campos". Primero, abre la tabla de atributos de la capa que deseas modificar. Luego, haz clic en el botón "Abrir calculadora de campos". En el cuadro "Expresión", escribe "to\_real(" seguido del nombre del campo que contiene la cadena que quieres convertir, y el paréntesis de cierre. Por ejemplo, para convertir un campo de texto llamado "string\_field" en un campo numérico, introduce "to\_real("string\_field")" en el cuadro Expresión. También puedes modificar el nombre del campo de salida y el tipo de datos seleccionando las opciones adecuadas. Por último, haz clic en "OK" para completar la conversión. El campo de texto original permanecerá en la tabla de atributos, mientras que el nuevo campo numérico se añadirá a la tabla.

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

1. Abrir "Propiedades"
2. Ir a "Calculadora de campos"
3. Marcar "Actualizar campo existente"
4. to\_real("attributeName")
5. Guardar ediciones
6. Repite lo mismo para cada atributo

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


---

# 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.geopard.tech/geopard-tutorials/esp/consejos-rapidos-de-sig/qgis-cambiar-valores-de-texto-a-numero-en-el-shapefile.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.
