# Import / Export

### Import Rules

Import rules are run when the data is imported from the source. The rule will change the incoming value from the data source. For example, if you have a value from a CSV file that is being imported as 0, you can transform the value using the `Text Manipulation` rule to change from `0` => `0.0`

*Example* You have a value that is received from the data source as a JSON object, say

```json
 {
   "id": 42,
   "refName" : "Material Name"
 }
```

You can use the

> `Select from Json`

rule to select the key called `refName` from this JSON object. The value displayed onscreen will be `Material Name`

*Example*

```json
[
{
   "id": 41,
   "refName" : "Material Name 1"
},
{
   "id": 42,
   "refName" : "Material Name 2"
 }
]
```

You can use the

> `Select from Json`

rule to select the key called `[1].refName` from this JSON object. The value displayed onscreen will be `Material Name 2`. The selector `[1].refName` uses a text string to select the value from the array of values. In this case select the 2nd element (indexes start at 0, so element 1 is the 2nd element in the array of 2 elements), then select the `refName` key on the element. Nested properties are supported.

### Export Rules

Export rules are run when the data is exported from SharpSync when using the `Submit BOM` button. The rule will change the value sent to the data source. For example, if you have value from a source, say Onshape, that was imported as `0`, the displayed onscreen as `0.0`, you can transform the value using the `Text Manipulation` rule to change from `0.0` => `0` so that the value may be accepted by Onshape.

### Rule explanations

Below is a comprehensive list of Import/Export Property Mapping Rules. Click a rule to explore it in depth.&#x20;

| Rule name                                                                                                                                                             | Type            | Description                                                                                               |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- | --------------------------------------------------------------------------------------------------------- |
| [Append Text](https://sharpsync.gitbook.io/sharpsync/~/changes/zcOMaRcqMhiRElzWzdJZ/property-mappings/rule-templates/import-export/append-text)                       | Import / Export | Adds the specified text to the end of the cell value                                                      |
| [Calculate number](https://sharpsync.gitbook.io/sharpsync/~/changes/zcOMaRcqMhiRElzWzdJZ/property-mappings/rule-templates/import-export/calculate-number)             | Import / Export | Uses the cell value and performs a calculation. The result of the calculation replaces the cell value     |
| [Export manipulation](https://sharpsync.gitbook.io/sharpsync/~/changes/zcOMaRcqMhiRElzWzdJZ/property-mappings/rule-templates/import-export/export-manipulation)       | Export only     | Runs the specified javascript expression when data is exported. Has the ability to remove rowData values  |
| [Format as decimal](https://sharpsync.gitbook.io/sharpsync/~/changes/zcOMaRcqMhiRElzWzdJZ/property-mappings/rule-templates/import-export/format-as-decimal-number)    | Import / Export | Converts the cell value to a number and adds the specified number of decimals. This does round the number |
| [Prepend text](https://sharpsync.gitbook.io/sharpsync/~/changes/zcOMaRcqMhiRElzWzdJZ/property-mappings/rule-templates/import-export/prepend-text)                     | Import / Export | Adds the specified text to the beginning of the cell value                                                |
| [Remove property](https://sharpsync.gitbook.io/sharpsync/~/changes/zcOMaRcqMhiRElzWzdJZ/property-mappings/rule-templates/import-export/remove-property)               | Export only     | Removes the specified property when exporting the data                                                    |
| [Replace all instances](https://sharpsync.gitbook.io/sharpsync/~/changes/zcOMaRcqMhiRElzWzdJZ/property-mappings/rule-templates/import-export/replace-all-instances)   | Import / Export | Replaces all instances of the specified text with the new value                                           |
| [Replace first instance](https://sharpsync.gitbook.io/sharpsync/~/changes/zcOMaRcqMhiRElzWzdJZ/property-mappings/rule-templates/import-export/replace-first-instance) | Import / Export | Replaces the first instance of the specified text with the new value                                      |
| [Round to nearest X](https://sharpsync.gitbook.io/sharpsync/~/changes/zcOMaRcqMhiRElzWzdJZ/property-mappings/rule-templates/import-export/round-to-nearest-x)         | Import / Export | Rounds the number to up or down the nearest specified digit                                               |
| [Select from Json](https://sharpsync.gitbook.io/sharpsync/~/changes/zcOMaRcqMhiRElzWzdJZ/property-mappings/rule-templates/import-export/select-from-json)             | Import / Export | Converts the cell value from text to a JSON object and returns the value given by the specified key       |
| [Set cell value](https://sharpsync.gitbook.io/sharpsync/~/changes/zcOMaRcqMhiRElzWzdJZ/property-mappings/rule-templates/import-export/set-cell-value)                 | Import / Export | Sets the cell value to the specified text. Existing text is replaced                                      |
| [Set empty cells](https://sharpsync.gitbook.io/sharpsync/~/changes/zcOMaRcqMhiRElzWzdJZ/property-mappings/rule-templates/import-export/set-empty-cells)               | Import / Export | Set an empty (any cell that has only whitespace or no value) cell value to the specified text             |
| [Text manipulation](https://sharpsync.gitbook.io/sharpsync/~/changes/zcOMaRcqMhiRElzWzdJZ/property-mappings/rule-templates/import-export/text-manipulation)           | Import / Export | Manipulates (and returns the result of) the cell value using the given the javascript expression          |
