Linker IT Software
Order Home
menubar-top-links menubar-top-rechts
SQL*XL: Database to Excel bridge ExcelLock: Lock and secure your valuable Excel spreadsheets encOffice: Protect your Excel file easy and safe
Home Products litLIB Help Filesystem functions

Buy now

Download now

LITlib - Excel Power Functions Pack
 
Add-in for Excel that adds additional cell functions to Excel.

litLIB Help - FileContents funtion
litLIB Help
Product pages :
litLIB
Quick links:
help index
forums

File System - FileContents

Syntax:
=FileContents(File [, StartPosition, Length])

This function is both a cell and an array function. To use the array function, select a range of cells (e.g. 5 rows and 1 column). Enter the formula and press Ctrl+Shift+Enter.

Description:
Returns the contents of a file. By default 255 characters are returned. Optionally the Length parameter can be given to return more characters (up to 32,000). The StartPosition parameter can be given to return characters starting at a specific offset position.

If used as an array formula it returns a line in each cell. The StartPosition parameter is interpreted as a line number.

FileContents can send up to 32768 characters to the worksheet but only half of these will be shown visibly. Note that when passing more than 255 characters directly into another function (nesting functions ; calling one function inside another function) Excel will return a #Value error.

File : Full name and path of the file

StartPosition : Byte offset position from where the filecontents should be shown. For array formulas, StartPosition is the line number from where to start.

Example:
=FileContents("c:\myfile.txt")
=FileContents("c:\myfile.txt", , 5000)

Array examples:
Select A1 to A10
Enter the following formula and press Ctrl+Shift+Enter
=filecontents("C:\windows\WindowsUpdate.log")

Result: 10 lines of the file will be shown, each in its own cell.

litLIB