Comments (13)
what software created the original file?
from spreadsheet.
The file was created with Windows version of Microsoft Excel, it's a .xls file too. I think it might have to do with the fact that the file has many use of merged cells.
I tried two simple tests to create an easy replication:
- open the file and use spreadsheet to write to new file -> no problem
- open the file and use spreadsheet to edit only one cell -> issue replicated
Would I be able to privately send the XLS file so you can confirm the issue?
I don't mind helping out by sponsoring the bugfix too. Let me know how much.
from spreadsheet.
Please try to open and save the file with LibreOffice and then try to edit it again using spreadsheet. Does that work?
from spreadsheet.
After saving w/ LibreOffice, now spreadsheet gem cannot read the excel.
Error:
Spreadsheet::Errors::UnknownCodepage: Unknown Codepage 0xac8d
from .../ruby/gems/2.6.0/gems/spreadsheet-1.2.7/lib/spreadsheet/excel/reader.rb:75:in `block in encoding'
from spreadsheet.
Did you save the file as UTF-8? Which version of LibreOffice and which OS are you using?
from spreadsheet.
LibreOffice 7.1.0.3, Mac OSX.
There is no option to choose UTF-8 when saving as xls. The resulting file can be opened in LibreOffice, but is not readable by spreadsheet gem. Can I email you the original file and you try to open/save with your libre office version, then read it in spreadsheet gem? This way we can eliminate the possibility of environmental factors?
from spreadsheet.
Please share the Ruby script with which you want to open the file. Also look at this commit here: https://github.com/zdavatz/spreadsheet/blob/master/History.md#111--03012016 where we had a similar error. Maybe you can send a Pull Request. This is the commit: e59b337
from spreadsheet.
I tried digging into the code myself, but was unable to get anywhere. Is there a way to know exactly what encoding LibreOffice is using when saving?
I tried setting the unknown codepage to MACROMAN, but would get invalid byte sequence errors, I tried UTF-8, and didn't get invalid byte sequence errors, but in BIFF8, it kept encountering a lot of errors due to nil values here and there.
from spreadsheet.
For me the question is which language/character uses that "strange" characterset in your XLS?
from spreadsheet.
It's all alphanumeric characters. Language is set to English (US), I changed all items to font "Times New Roman"
I even tried running a macros to enforce all alphanumeric characters only.
REM ***** BASIC *****
Function AlphaNumericOnly(strSource As String) As String
Dim i As Integer
Dim strResult As String
For i = 1 To Len(strSource)
Select Case Asc(Mid(strSource, i, 1))
Case 32 To 32, 48 To 57, 65 To 90, 97 To 122: 'include 32 if you want to include space
strResult = strResult & Mid(strSource, i, 1)
End Select
Next
AlphaNumericOnly = strResult
End Function
Function CleanSheet(sheetName As String) As Boolean
Dim sh As Object, z As Object, c As Object
Dim qCells As Object, enuCells As Object
sh = ThisComponent.Sheets.getByName(sheetName)
z = sh.getCellRangeByName("A1:U300")
qCells = z.queryContentCells(-1)
enuCells = qCells.Cells.createEnumeration
Do While enuCells.hasMoreElements
c = enuCells.nextElement
If Left(c.Formula, 1) = "=" Then
Else
c.string = AlphaNumericOnly(c.String)
End If
Loop
CleanSheet = true
End Function
Sub CleanAll()
CleanSheet("GRID")
CleanSheet("RESULTS")
CleanSheet("PICTURES")
End Sub
from spreadsheet.
Which Windows Version and which MS Excel Version created the orginial file? Can these people try to create the same file using LibreOffice on Windows?
from spreadsheet.
After some messing around with different settings, the following combination fixed my issue:
- Uncheck "Protect Sheet"
- Uncheck "Protect Spreadsheet Structure"
from spreadsheet.
Ok, good to know, thank you for reporting!
from spreadsheet.
Related Issues (20)
- File `xls` styles not appearing if open by google doc HOT 2
- How to add a picture HOT 3
- Cells with text >= 32KB in length result in MS Excel failing to open HOT 6
- What's the plan about TODO (Percent style)? HOT 3
- Seemingly empty file after adding 'too many' rows HOT 1
- Cannot write spreadsheet to an already opened file HOT 15
- Save Images from Excel Spreadsheets HOT 1
- Editing existing excel HOT 8
- Failing to read XLS file: process doesn't terminate. HOT 6
- Error opening a spreadsheet created by this gem HOT 5
- No read Excel rows more then 65353 HOT 4
- Create an excel file with more than 256 columns HOT 5
- Adding styling to a sheet tab HOT 5
- Formula referencing value in different sheet is broken HOT 8
- Max rows count HOT 10
- Incorrect MIME type HOT 1
- Format missing after certain rows and columns HOT 7
- Workbook problem HOT 1
- Images & formatting lost after writing to existing file HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spreadsheet.