| 
									
										
										
										
											2017-03-20 09:02:25 +00:00
										 |  |  | ## Working with the Workbook
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | The full object format is described later in this README. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | This example extracts the value stored in cell A1 from the first worksheet: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```js | 
					
						
							|  |  |  | var first_sheet_name = workbook.SheetNames[0]; | 
					
						
							|  |  |  | var address_of_cell = 'A1'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Get worksheet */ | 
					
						
							|  |  |  | var worksheet = workbook.Sheets[first_sheet_name]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Find desired cell */ | 
					
						
							|  |  |  | var desired_cell = worksheet[address_of_cell]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Get the value */ | 
					
						
							|  |  |  | var desired_value = (desired_cell ? desired_cell.v : undefined); | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-30 20:37:53 +00:00
										 |  |  | ### Complete Examples
 | 
					
						
							| 
									
										
										
										
											2017-03-20 09:02:25 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | - <https://github.com/SheetJS/js-xlsx/blob/master/bin/xlsx.njs> node | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | The node version installs a command line tool `xlsx` which can read spreadsheet | 
					
						
							|  |  |  | files and output the contents in various formats.  The source is available at | 
					
						
							|  |  |  | `xlsx.njs` in the bin directory. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Some helper functions in `XLSX.utils` generate different views of the sheets: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | - `XLSX.utils.sheet_to_csv` generates CSV | 
					
						
							|  |  |  | - `XLSX.utils.sheet_to_json` generates an array of objects | 
					
						
							|  |  |  | - `XLSX.utils.sheet_to_formulae` generates a list of formulae | 
					
						
							|  |  |  | 
 |