Skip to content →

Reading data from a spreadsheet

Reading data from a spreadsheet can be done in multiple ways:

  1. Read a file using automatic file type detection
  2. Read a file by specifying the file type
  3. Read a file and opening specific worksheets
  4. Read a file in read-only mode
  5. Read a file and open only specific cells

How to read a file, by automatically detecting the file type

You should use this when you don’t know what file format the user will load.

How to read a file by specifying the file type:

This is faster than using the automatically detecting file type.

How to load only specific worksheets

How to open a file in read-only mode

How to read specific cells:

The following code will only read row 1 and rows 20 – 30 of any sheet in the Excel file:

Published in Introduction to PhpSpreadsheet

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.