There are 2 Xess functions you will want to use to do this, polyfit and polycoef.
Take, for example, the following data:
To do a least squares fit, you will want to move the cursor to an adjacent vacant column (e.g. C1) and enter the following command,
The first range is the "x" data and the second range is the "y" data. The last number indicates the degree of the polynomial (1 for linear, 2 for quadratic, etc.). The polyfit command will then generate the y values corresponding to the type of polynomial fit you desire.
To get the coefficients of the fit, go to another unoccupied cell (e.g. D1) and enter the following,
Your spreadsheet now will look like,
Column C contains the y values of the fitted data points, and column D contains the coefficients of the fitted polynomial in descending order; in a linear fit, these correspond to the slope and intercept of the line.
To plot this, you would select "graph", then "New Graph", then the type of graph you want (in this case, "Line Graph"). Now you need to select your data ranges. Go to the graphics window and select "Edit" then "Data Sets".
Click in the X Range and enter the data range for the x data (you can also just highlight the data range and click on the middle mouse in the appropriate box and the range will appear), then click in the Y Range and enter the range for your y data. Then you want to select "Line Style" = "No
Line" so only data points are shown. Now, to display the fitted curve, go to "Edit", "Data Sets", then drag the drag bar to go to data set 2. Enter new X-range (same as the old X-range), and the Y-range corresponding to the fitted data (Column C). Select "Line Style" = "Solid", then "Apply". You should have a graph with data points and a fitted line through them. If you want to get a little more sophisticated and display the coefficients on the graph, goto "Options" in the Graph Editor, select "General" and click in the "Legend" box to enable legends. Then, "Edit", "Data Sets" and enter in the "Legend" text box,
Experiment to get the graph looking the way you want.