I recently imported a number of large excel 2010 spreadsheets (which was exported to CSV for the import) into a database. I have now been told that the cell comments are missing (I didn’t even know there were cell comments in the original Excel file, I only ever had the CSV).
I need to search each row of the Excel file, find cells with cell comments, grab the comment and add it into the database for that row (the database references the row number from the spreadsheet, so if I can just extract row number and all the cell comments in that row, that’s perfect)
My skills are in PHP and Perl. Ideally I would use PHP to read and process the data, but using something else to output text/csv, which I can then parse with PHP would work fine too.
Does anyone know a way to extract these cell comments, or have any pointers?
Thanks!
Use the PHPExcel library. Comments are held against the worksheet. and the worksheet’s getComments() method will return an array of comment objects indexed by their cell address.
EDIT
Note, my example uses an Excel .xls file, but the method will work just as easily replacing the $inputFileType with “Excel2007” for an .xlsx file