Excel to Array Converter

Turn Excel, CSV and ODS spreadsheets into ready-to-paste arrays for JavaScript, Python, Java, C#, PHP, Go, Ruby and Rust, as objects keyed by the header row or 2D arrays. Free, with no account, and your file stays in your browser.

Excel File

Open a spreadsheet

Drop an Excel, CSV or ODS file here, or choose one on your device.

XLSX, XLS, CSV or ODS · Up to 10 MB

Open an Excel, CSV or ODS file. The array code appears here and follows your settings.

Array code JavaScript

The array code appears here once a file is read.

How to Use

  1. Drop your Excel file (XLSX, XLS, CSV or ODS) on the input panel or choose one on your device. Files stay on your device and can be up to 10MB
  2. In Settings, choose your target programming language and preferred output format: 2D array for raw data or object array using headers as keys
  3. Set header handling and data type auto-detection in Settings. If the file has several sheets, choose the one to convert under the file
  4. Copy the generated array code to your clipboard with one click, or download it as a file ready for integration into your project

Pro Tips

  • Use the first row as headers for better object array output
  • Turn on data type detection to convert numeric text into real numbers
  • Files up to 10MB can be converted
  • All processing happens in your browser - no data is sent to servers

Turning Excel Spreadsheets into Code Arrays

What this converter does

Excel stores data in rows and columns, while most programming languages consume that same data as arrays. This tool reads the workbook you open (XLSX, XLS, CSV, or ODS, up to 10 MB), parses its sheets, and rewrites the cell grid as ready-to-paste array literals for the language you pick: JavaScript, Python, Java, C#, PHP, Go, Ruby, or Rust. You can output either a two-dimensional array that mirrors the raw grid, or an array of objects that uses the header row as keys.

Because the output is generated from the actual sheet structure rather than a fixed template, whatever columns and rows the file contains are what you get back in code.

When to use it

Reach for it whenever you need spreadsheet data baked into code rather than loaded at runtime: seed data for tests, a lookup table, fixtures, a hard-coded config, or a quick mock for a prototype. It saves writing a parser or hand-typing dozens of rows. An analyst who keeps reference data in Excel can hand a developer a paste-ready literal, and the developer can pull a client's spreadsheet straight into the exact syntax the project already uses. Two details usually follow: dates come through as the text Excel displays, such as 2024-01-15, and when a column holds Unix timestamps instead, the Unix timestamp converter reads them back; and when the destination is a data file rather than source code, the CSV ↔ JSON converter is the closer fit.

A concrete example

Suppose a sheet has the header row Name, Age, Active followed by its data rows. With "use first row as headers" on and object-array output selected for JavaScript, you get `const data = [ {Name: "Alice", Age: 30, Active: "TRUE"}, ... ];`. Turn headers off and switch to a 2D array, and the same sheet becomes `[["Name","Age","Active"], ["Alice","30","TRUE"], ...]`. With type detection on, 30 stays a number in the object-array output instead of being quoted as text.

Notes and edge cases

When a workbook holds several sheets, the first one is converted until you pick another from the Sheet list. Cells come through the way Excel shows them, so a date appears as text such as 2024-01-15 rather than a serial number. With object-array output, auto type detection turns numeric text into real numbers; disable it to keep every cell as a string when the column really is text, such as ZIP codes or ID codes with leading zeros.

Frequently Asked Questions

Yes. You can convert any number of XLSX, XLS, CSV, or ODS files into arrays for JavaScript, Python, Java, C#, PHP, Go, Ruby, and Rust at no cost. Sheet selection and type detection are included, with no usage cap or paid tier.