---
title: "Importing CSV data by keeping number formats of cells on Google Sheets using Google Apps Script"
author: "Martin Hawksey"
date: 2022-01-26T22:05:56+00:00
modified: 2022-01-26T22:06:06+00:00
canonical_url: https://pulse.appsscript.info/p/2022/01/importing-csv-data-by-keeping-number-formats-of-cells-on-google-sheets-using-google-apps-script/
markdown_url: https://pulse.appsscript.info/p/2022/01/importing-csv-data-by-keeping-number-formats-of-cells-on-google-sheets-using-google-apps-script.md
categories:
  - "Intermediate"
  - "Sheets"
  - "Solutions"
  - "V8"
tags:
  - "tanaikech.github.io"
featured_image: https://pulse.appsscript.info/files/2022/01/mika-baumeister-Wpnoqo2plFA-unsplash.jpg
description: "This is a sample script for importing a CSV data by keeping the number formats of cells on Google Spreadsheet using Google Apps Script. When a CSV data is manually put using the default UI using the browser, it seems that the number formats of all cells cannot be kept. In order to import the CSV data to the cells with keeping the number formats, it is required to use a script as a workaround. In this workaround, Google Apps Script is used. When the following sample script of Google Apps Script is run, a dialog is opened. And, when the CSV file is selected from your local PC on the dialog, the CSV file is loaded, and then, the CSV data is put to the active cell with keeping the number formats of cells."
---

# Importing CSV data by keeping number formats of cells on Google Sheets using Google Apps Script

![Importing CSV data by keeping number formats of cells on Google Sheets using Google Apps Script](https://pulse.appsscript.info/files/2022/01/mika-baumeister-Wpnoqo2plFA-unsplash.jpg)

> Photo by [Mika Baumeister](https://unsplash.com/@mbaumi) on [Unsplash](https://unsplash.com/s/photos/spreadsheet)
> This is a sample script for importing a CSV data by keeping the number formats of cells on Google Spreadsheet using Google Apps Script.
> When a CSV data is manually put using the default UI using the browser, it seems that the number formats of all cells cannot be kept. In order to import the CSV data to the cells with keeping the number formats, it is required to use a script as a workaround. In this workaround, Google Apps Script is used.
> When the following sample script of Google Apps Script is run, a dialog is opened. And, when the CSV file is selected from your local PC on the dialog, the CSV file is loaded, and then, the CSV data is put to the active cell with keeping the number formats of cells.

The quoted post description explains everything you need about this solution and worth clicking through to see how the code works.

Source: [Importing CSV Data by Keeping Number Formats of Cells on Google Spreadsheet using Google Apps Script**](https://tanaikech.github.io/2022/01/07/importing-csv-data-by-keeping-number-formats-of-cells-on-google-spreadsheet-using-google-apps-script/)

---

*Published by [Martin Hawksey](https://pulse.appsscript.info/p/author/admin/) on [Pulse](https://pulse.appsscript.info/). Original article: [https://pulse.appsscript.info/p/2022/01/importing-csv-data-by-keeping-number-formats-of-cells-on-google-sheets-using-google-apps-script/](https://pulse.appsscript.info/p/2022/01/importing-csv-data-by-keeping-number-formats-of-cells-on-google-sheets-using-google-apps-script/)*
