read-excel-file 7.0.2 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +212 -205
  3. package/browser/index.cjs +8 -5
  4. package/browser/index.d.ts +58 -16
  5. package/browser/index.js +7 -5
  6. package/browser/input.d.ts +1 -0
  7. package/bundle/read-excel-file.min.js +1 -1
  8. package/bundle/read-excel-file.min.js.map +1 -1
  9. package/commonjs/export/parseSheet.js +20 -0
  10. package/commonjs/export/parseSheet.js.map +1 -0
  11. package/commonjs/export/readSheetBrowser.js +29 -0
  12. package/commonjs/export/readSheetBrowser.js.map +1 -0
  13. package/commonjs/export/readSheetNode.js +29 -0
  14. package/commonjs/export/readSheetNode.js.map +1 -0
  15. package/commonjs/export/readSheetUniversal.js +29 -0
  16. package/commonjs/export/readSheetUniversal.js.map +1 -0
  17. package/commonjs/export/readSheetWebWorker.js +29 -0
  18. package/commonjs/export/readSheetWebWorker.js.map +1 -0
  19. package/commonjs/export/readXlsxFileBrowser.js +6 -8
  20. package/commonjs/export/readXlsxFileBrowser.js.map +1 -1
  21. package/commonjs/export/readXlsxFileNode.js +7 -9
  22. package/commonjs/export/readXlsxFileNode.js.map +1 -1
  23. package/commonjs/export/readXlsxFileUniversal.js +7 -9
  24. package/commonjs/export/readXlsxFileUniversal.js.map +1 -1
  25. package/commonjs/export/readXlsxFileWebWorker.js +6 -8
  26. package/commonjs/export/readXlsxFileWebWorker.js.map +1 -1
  27. package/commonjs/export/unpackXlsxFileBrowser.js +2 -1
  28. package/commonjs/export/unpackXlsxFileBrowser.js.map +1 -1
  29. package/commonjs/export/unpackXlsxFileNode.js +4 -3
  30. package/commonjs/export/unpackXlsxFileNode.js.map +1 -1
  31. package/commonjs/export/unpackXlsxFileUniversal.js +13 -3
  32. package/commonjs/export/unpackXlsxFileUniversal.js.map +1 -1
  33. package/commonjs/parseData/InvalidError.js.map +1 -0
  34. package/commonjs/parseData/parseData.js +503 -0
  35. package/commonjs/parseData/parseData.js.map +1 -0
  36. package/commonjs/parseData/parseData.test.js.map +1 -0
  37. package/commonjs/{types → parseData/types}/Boolean.js +1 -1
  38. package/commonjs/parseData/types/Boolean.js.map +1 -0
  39. package/commonjs/parseData/types/Date.js +21 -0
  40. package/commonjs/parseData/types/Date.js.map +1 -0
  41. package/commonjs/{types → parseData/types}/Number.js +1 -1
  42. package/commonjs/parseData/types/Number.js.map +1 -0
  43. package/commonjs/{types → parseData/types}/String.js +1 -1
  44. package/commonjs/parseData/types/String.js.map +1 -0
  45. package/commonjs/{types → parseData/types/additional}/Email.js +3 -3
  46. package/commonjs/parseData/types/additional/Email.js.map +1 -0
  47. package/commonjs/parseData/types/additional/Email.test.js.map +1 -0
  48. package/commonjs/{types → parseData/types/additional}/Integer.js +2 -2
  49. package/commonjs/parseData/types/additional/Integer.js.map +1 -0
  50. package/commonjs/parseData/types/additional/Integer.test.js.map +1 -0
  51. package/commonjs/{types → parseData/types/additional}/URL.js +3 -3
  52. package/commonjs/parseData/types/additional/URL.js.map +1 -0
  53. package/commonjs/parseData/types/additional/URL.test.js.map +1 -0
  54. package/commonjs/xlsx/{getData.js → convertCellsToData2dArray.js} +16 -37
  55. package/commonjs/xlsx/convertCellsToData2dArray.js.map +1 -0
  56. package/commonjs/xlsx/{isDateTimestamp.js → isDateFormat.js} +58 -56
  57. package/commonjs/xlsx/isDateFormat.js.map +1 -0
  58. package/commonjs/xlsx/isDateFormat.test.js.map +1 -0
  59. package/commonjs/xlsx/isDateFormatStyle.js +193 -0
  60. package/commonjs/xlsx/isDateFormatStyle.js.map +1 -0
  61. package/commonjs/xlsx/parseCell.js +16 -18
  62. package/commonjs/xlsx/parseCell.js.map +1 -1
  63. package/commonjs/xlsx/parseCellCoordinates.js +44 -0
  64. package/commonjs/xlsx/parseCellCoordinates.js.map +1 -0
  65. package/commonjs/xlsx/parseCellValue.js +14 -11
  66. package/commonjs/xlsx/parseCellValue.js.map +1 -1
  67. package/commonjs/xlsx/parseCells.js +14 -6
  68. package/commonjs/xlsx/parseCells.js.map +1 -1
  69. package/commonjs/xlsx/parseExcelDate.js +139 -0
  70. package/commonjs/xlsx/parseExcelDate.js.map +1 -0
  71. package/commonjs/xlsx/parseExcelDate.test.js.map +1 -0
  72. package/commonjs/xlsx/parseSheet.js +9 -11
  73. package/commonjs/xlsx/parseSheet.js.map +1 -1
  74. package/commonjs/xlsx/{parseDimensions.js → parseSheetDimensions.js} +7 -6
  75. package/commonjs/xlsx/parseSheetDimensions.js.map +1 -0
  76. package/commonjs/xlsx/parseSpreadsheetContents.js +96 -0
  77. package/commonjs/xlsx/parseSpreadsheetContents.js.map +1 -0
  78. package/commonjs/xlsx/parseSpreadsheetInfo.js +47 -0
  79. package/commonjs/xlsx/parseSpreadsheetInfo.js.map +1 -0
  80. package/commonjs/xlsx/reconstructSheetDimensionsFromSheetCells.js +29 -0
  81. package/commonjs/xlsx/reconstructSheetDimensionsFromSheetCells.js.map +1 -0
  82. package/commonjs/xml/xlsx.js +9 -9
  83. package/commonjs/xml/xlsx.js.map +1 -1
  84. package/commonjs/xml/xpath/xlsx-xpath.js +8 -8
  85. package/commonjs/xml/xpath/xlsx-xpath.js.map +1 -1
  86. package/commonjs/xml/xpath/xpathBrowser.js +4 -4
  87. package/commonjs/xml/xpath/xpathBrowser.js.map +1 -1
  88. package/commonjs/xml/xpath/xpathNode.js +2 -2
  89. package/commonjs/xml/xpath/xpathNode.js.map +1 -1
  90. package/modules/export/parseSheet.js +13 -0
  91. package/modules/export/parseSheet.js.map +1 -0
  92. package/modules/export/readSheetBrowser.js +23 -0
  93. package/modules/export/readSheetBrowser.js.map +1 -0
  94. package/modules/export/readSheetNode.js +23 -0
  95. package/modules/export/readSheetNode.js.map +1 -0
  96. package/modules/export/readSheetUniversal.js +23 -0
  97. package/modules/export/readSheetUniversal.js.map +1 -0
  98. package/modules/export/readSheetWebWorker.js +23 -0
  99. package/modules/export/readSheetWebWorker.js.map +1 -0
  100. package/modules/export/readXlsxFileBrowser.js +6 -8
  101. package/modules/export/readXlsxFileBrowser.js.map +1 -1
  102. package/modules/export/readXlsxFileNode.js +7 -9
  103. package/modules/export/readXlsxFileNode.js.map +1 -1
  104. package/modules/export/readXlsxFileUniversal.js +7 -9
  105. package/modules/export/readXlsxFileUniversal.js.map +1 -1
  106. package/modules/export/readXlsxFileWebWorker.js +6 -8
  107. package/modules/export/readXlsxFileWebWorker.js.map +1 -1
  108. package/modules/export/unpackXlsxFileBrowser.js +3 -1
  109. package/modules/export/unpackXlsxFileBrowser.js.map +1 -1
  110. package/modules/export/unpackXlsxFileNode.js +4 -3
  111. package/modules/export/unpackXlsxFileNode.js.map +1 -1
  112. package/modules/export/unpackXlsxFileUniversal.js +13 -3
  113. package/modules/export/unpackXlsxFileUniversal.js.map +1 -1
  114. package/modules/parseData/InvalidError.js.map +1 -0
  115. package/modules/parseData/parseData.js +494 -0
  116. package/modules/parseData/parseData.js.map +1 -0
  117. package/modules/parseData/parseData.test.js.map +1 -0
  118. package/modules/{types → parseData/types}/Boolean.js +1 -1
  119. package/modules/parseData/types/Boolean.js.map +1 -0
  120. package/modules/parseData/types/Date.js +14 -0
  121. package/modules/parseData/types/Date.js.map +1 -0
  122. package/modules/{types → parseData/types}/Number.js +1 -1
  123. package/modules/parseData/types/Number.js.map +1 -0
  124. package/modules/{types → parseData/types}/String.js +1 -1
  125. package/modules/parseData/types/String.js.map +1 -0
  126. package/modules/{types → parseData/types/additional}/Email.js +3 -3
  127. package/modules/parseData/types/additional/Email.js.map +1 -0
  128. package/modules/parseData/types/additional/Email.test.js.map +1 -0
  129. package/modules/{types → parseData/types/additional}/Integer.js +2 -2
  130. package/modules/parseData/types/additional/Integer.js.map +1 -0
  131. package/modules/parseData/types/additional/Integer.test.js.map +1 -0
  132. package/modules/{types → parseData/types/additional}/URL.js +3 -3
  133. package/modules/parseData/types/additional/URL.js.map +1 -0
  134. package/modules/parseData/types/additional/URL.test.js.map +1 -0
  135. package/modules/xlsx/{getData.js → convertCellsToData2dArray.js} +15 -36
  136. package/modules/xlsx/convertCellsToData2dArray.js.map +1 -0
  137. package/modules/xlsx/{isDateTimestamp.js → isDateFormat.js} +57 -55
  138. package/modules/xlsx/isDateFormat.js.map +1 -0
  139. package/modules/xlsx/isDateFormat.test.js.map +1 -0
  140. package/modules/xlsx/isDateFormatStyle.js +186 -0
  141. package/modules/xlsx/isDateFormatStyle.js.map +1 -0
  142. package/modules/xlsx/parseCell.js +17 -19
  143. package/modules/xlsx/parseCell.js.map +1 -1
  144. package/modules/xlsx/parseCellCoordinates.js +38 -0
  145. package/modules/xlsx/parseCellCoordinates.js.map +1 -0
  146. package/modules/xlsx/parseCellValue.js +14 -11
  147. package/modules/xlsx/parseCellValue.js.map +1 -1
  148. package/modules/xlsx/parseCells.js +14 -6
  149. package/modules/xlsx/parseCells.js.map +1 -1
  150. package/modules/xlsx/parseExcelDate.js +133 -0
  151. package/modules/xlsx/parseExcelDate.js.map +1 -0
  152. package/modules/xlsx/parseExcelDate.test.js.map +1 -0
  153. package/modules/xlsx/parseSheet.js +9 -11
  154. package/modules/xlsx/parseSheet.js.map +1 -1
  155. package/modules/xlsx/{parseDimensions.js → parseSheetDimensions.js} +4 -4
  156. package/modules/xlsx/parseSheetDimensions.js.map +1 -0
  157. package/modules/xlsx/parseSpreadsheetContents.js +91 -0
  158. package/modules/xlsx/parseSpreadsheetContents.js.map +1 -0
  159. package/modules/xlsx/parseSpreadsheetInfo.js +42 -0
  160. package/modules/xlsx/parseSpreadsheetInfo.js.map +1 -0
  161. package/modules/xlsx/reconstructSheetDimensionsFromSheetCells.js +23 -0
  162. package/modules/xlsx/reconstructSheetDimensionsFromSheetCells.js.map +1 -0
  163. package/modules/xml/xlsx.js +6 -6
  164. package/modules/xml/xlsx.js.map +1 -1
  165. package/modules/xml/xpath/xlsx-xpath.js +6 -6
  166. package/modules/xml/xpath/xlsx-xpath.js.map +1 -1
  167. package/modules/xml/xpath/xpathBrowser.js +4 -4
  168. package/modules/xml/xpath/xpathBrowser.js.map +1 -1
  169. package/modules/xml/xpath/xpathNode.js +2 -2
  170. package/modules/xml/xpath/xpathNode.js.map +1 -1
  171. package/node/index.cjs +8 -5
  172. package/node/index.d.ts +56 -21
  173. package/node/index.js +7 -5
  174. package/node/input.d.ts +5 -0
  175. package/package.json +1 -1
  176. package/rollup.config.mjs +1 -1
  177. package/types/parseData/parseData.d.ts +38 -0
  178. package/types/parseData/parseDataError.d.ts +239 -0
  179. package/types/parseData/parseDataSchema.d.ts +48 -0
  180. package/types/parseData/parseDataValueType.d.ts +45 -0
  181. package/types/types.d.ts +20 -0
  182. package/universal/index.cjs +8 -5
  183. package/universal/index.d.ts +58 -16
  184. package/universal/index.js +7 -5
  185. package/universal/input.d.ts +1 -0
  186. package/web-worker/index.cjs +8 -5
  187. package/web-worker/index.d.ts +58 -16
  188. package/web-worker/index.js +7 -5
  189. package/web-worker/input.d.ts +1 -0
  190. package/commonjs/export/readSheetNamesBrowser.js +0 -23
  191. package/commonjs/export/readSheetNamesBrowser.js.map +0 -1
  192. package/commonjs/export/readSheetNamesNode.js +0 -23
  193. package/commonjs/export/readSheetNamesNode.js.map +0 -1
  194. package/commonjs/export/readSheetNamesUniversal.js +0 -23
  195. package/commonjs/export/readSheetNamesUniversal.js.map +0 -1
  196. package/commonjs/export/readSheetNamesWebWorker.js +0 -23
  197. package/commonjs/export/readSheetNamesWebWorker.js.map +0 -1
  198. package/commonjs/types/Boolean.js.map +0 -1
  199. package/commonjs/types/Date.js +0 -36
  200. package/commonjs/types/Date.js.map +0 -1
  201. package/commonjs/types/Email.js.map +0 -1
  202. package/commonjs/types/Email.test.js.map +0 -1
  203. package/commonjs/types/Integer.js.map +0 -1
  204. package/commonjs/types/Integer.test.js.map +0 -1
  205. package/commonjs/types/InvalidError.js.map +0 -1
  206. package/commonjs/types/Number.js.map +0 -1
  207. package/commonjs/types/String.js.map +0 -1
  208. package/commonjs/types/URL.js.map +0 -1
  209. package/commonjs/types/URL.test.js.map +0 -1
  210. package/commonjs/xlsx/coordinates.js +0 -55
  211. package/commonjs/xlsx/coordinates.js.map +0 -1
  212. package/commonjs/xlsx/getData.js.map +0 -1
  213. package/commonjs/xlsx/isDateTimestamp.js.map +0 -1
  214. package/commonjs/xlsx/parseDate.js +0 -73
  215. package/commonjs/xlsx/parseDate.js.map +0 -1
  216. package/commonjs/xlsx/parseDate.test.js.map +0 -1
  217. package/commonjs/xlsx/parseDimensions.js.map +0 -1
  218. package/commonjs/xlsx/parseProperties.js +0 -46
  219. package/commonjs/xlsx/parseProperties.js.map +0 -1
  220. package/commonjs/xlsx/parseXlsxFileContents.js +0 -119
  221. package/commonjs/xlsx/parseXlsxFileContents.js.map +0 -1
  222. package/commonjs/xlsx/parseXlsxFileContentsWithOptionalSchema.js +0 -45
  223. package/commonjs/xlsx/parseXlsxFileContentsWithOptionalSchema.js.map +0 -1
  224. package/commonjs/xlsx/schema/mapToObjects.js +0 -482
  225. package/commonjs/xlsx/schema/mapToObjects.js.map +0 -1
  226. package/commonjs/xlsx/schema/mapToObjects.test.js.map +0 -1
  227. package/modules/export/readSheetNamesBrowser.js +0 -17
  228. package/modules/export/readSheetNamesBrowser.js.map +0 -1
  229. package/modules/export/readSheetNamesNode.js +0 -17
  230. package/modules/export/readSheetNamesNode.js.map +0 -1
  231. package/modules/export/readSheetNamesUniversal.js +0 -17
  232. package/modules/export/readSheetNamesUniversal.js.map +0 -1
  233. package/modules/export/readSheetNamesWebWorker.js +0 -17
  234. package/modules/export/readSheetNamesWebWorker.js.map +0 -1
  235. package/modules/types/Boolean.js.map +0 -1
  236. package/modules/types/Date.js +0 -29
  237. package/modules/types/Date.js.map +0 -1
  238. package/modules/types/Email.js.map +0 -1
  239. package/modules/types/Email.test.js.map +0 -1
  240. package/modules/types/Integer.js.map +0 -1
  241. package/modules/types/Integer.test.js.map +0 -1
  242. package/modules/types/InvalidError.js.map +0 -1
  243. package/modules/types/Number.js.map +0 -1
  244. package/modules/types/String.js.map +0 -1
  245. package/modules/types/URL.js.map +0 -1
  246. package/modules/types/URL.test.js.map +0 -1
  247. package/modules/xlsx/coordinates.js +0 -48
  248. package/modules/xlsx/coordinates.js.map +0 -1
  249. package/modules/xlsx/getData.js.map +0 -1
  250. package/modules/xlsx/isDateTimestamp.js.map +0 -1
  251. package/modules/xlsx/parseDate.js +0 -67
  252. package/modules/xlsx/parseDate.js.map +0 -1
  253. package/modules/xlsx/parseDate.test.js.map +0 -1
  254. package/modules/xlsx/parseDimensions.js.map +0 -1
  255. package/modules/xlsx/parseProperties.js +0 -41
  256. package/modules/xlsx/parseProperties.js.map +0 -1
  257. package/modules/xlsx/parseXlsxFileContents.js +0 -114
  258. package/modules/xlsx/parseXlsxFileContents.js.map +0 -1
  259. package/modules/xlsx/parseXlsxFileContentsWithOptionalSchema.js +0 -39
  260. package/modules/xlsx/parseXlsxFileContentsWithOptionalSchema.js.map +0 -1
  261. package/modules/xlsx/schema/mapToObjects.js +0 -472
  262. package/modules/xlsx/schema/mapToObjects.js.map +0 -1
  263. package/modules/xlsx/schema/mapToObjects.test.js.map +0 -1
  264. package/types.d.ts +0 -121
  265. /package/commonjs/{types → parseData}/InvalidError.js +0 -0
  266. /package/modules/{types → parseData}/InvalidError.js +0 -0
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = parseExcelDate;
7
+ // Parses an Excel Date (represented by a "serial" floating-point number)
8
+ // into a javascript `Date` in UTC+0 timezone (with time is set to 00:00).
9
+ //
10
+ // https://www.pcworld.com/article/3063622/software/mastering-excel-date-time-serial-numbers-networkdays-datevalue-and-more.html
11
+ // "If you need to calculate dates in your spreadsheets,
12
+ // Excel uses its own unique system, which it calls Serial Numbers".
13
+ //
14
+ function parseExcelDate(excelSerialDate, options) {
15
+ // Windows operating system uses floating-point numbers to represent dates,
16
+ // where the number represents the count of days elapsed since January 0th, 1900.
17
+ //
18
+ // This also means that there're 2 aspects associated with this choice:
19
+ //
20
+ // * January 1st, 1900, 00:00 is represented by `1` rather than `0`, which looks a bit weird.
21
+ // * 1900 is a special year because it's a "one in a 100 years" occasion when it's not a leap year.
22
+ //
23
+ // To work around those two aspects, Mac OS chose another baseline — January 1st, 1900.
24
+ // Although, that only postponed the second issue because 2100 is going to be the next "speciaL" year
25
+ // which is not going to be a "leap" one.
26
+ //
27
+ // Older versions of Excel on Mac OS used year 1904 as the default baseline for numeric dates.
28
+ // Since 2011, Microsoft Excel on Mac OS uses year 1900 as the default baseline for cross-platform consistency.
29
+ // https://support.microsoft.com/en-us/office/date-systems-in-excel-e7fe7167-48a9-4b96-bb53-5612a800b487
30
+ //
31
+ // So the 1904 baseline is now deprecated, although still available to be configured manually.
32
+ // So it still might be encountered in Excel files created on MacOS.
33
+ // In that case, the Excel file contains a special flag — `<workbook><workbookPr date1904="1"/>...` —
34
+ // that tells the application which baseline is being used for numeric date timestamps.
35
+ //
36
+ if (options && options.epoch1904) {
37
+ // Convert the numeric date timestamp from 1904 baseline to 1900 baseline.
38
+ excelSerialDate += (1904 - 1900) * DAYS_IN_YEAR + JANUARY_0TH_1900_DAY + ERRONEOUS_FEBRUARY_29_1990_DAY;
39
+ }
40
+ var daysBeforeUnixEpoch = JANUARY_0TH_1900_DAY + ERRONEOUS_FEBRUARY_29_1990_DAY + (1970 - 1900) * DAYS_IN_YEAR + NUMBER_OF_LEAP_YEARS_BETWEEN_1900_AND_1970;
41
+ return new Date(Math.floor((excelSerialDate - daysBeforeUnixEpoch) * DAY));
42
+ }
43
+
44
+ // "Excel serial date" is just a (fractional) count of days passed since `00/01/1900`.
45
+ //
46
+ // In contrast, "Unix timestamps" use `01/01/1970` as the baseline for numeric dates.
47
+ //
48
+ // In order to convert one into another, it should calculate the count of days elapsed
49
+ // since `00/01/1900` (Excel epoch) till `01/01/1970` (Unix epoch), or the count of days
50
+ // between year `1900` and year `1970`, plus one day.
51
+ //
52
+ // It also should account for the number of "leap years" between year `1900` and year `1970`,
53
+ // which is 17 of them. https://kalender-365.de/leap-years.php
54
+ //
55
+ // "One year has the length of 365 days, 5 hours, 48 minutes and 45 seconds.
56
+ // These are 365.2421875 days. This is hard to calculate with, so for practical reasons
57
+ // a normal year has been given 365 days and a leap year 366 days. In leap years,
58
+ // February 29th is added as leap day, which doesn't exist in a normal year.
59
+ // A leap year is every 4 years, but not every 100 years, then again every 400 years.
60
+ // So the year 1900 wasn't a leap year, but 2000 was".
61
+ //
62
+ // And also, Excel has a historical bug when it incorrectly assumes year `1900` to be a leap year,
63
+ // and, as a result, all Excel serial dates starting from March 1st, 1900 lag 1 day behind
64
+ // and require an additional 1 day to be added to them in order to be converted to a proper timestamp.
65
+ //
66
+ // https://learn.microsoft.com/en-us/answers/questions/5249322/why-does-microsoft-excel-considers-29-02-1900-to-b?forum=msoffice-all&referrer=answers#:~:text=This%20made%20it%20easier%20for,other%20programs%20that%20use%20dates.
67
+ //
68
+ // "When Lotus 1-2-3 was first released, the program assumed that the year 1900 was a leap year,
69
+ // even though it actually was not a leap year. This made it easier for the program to handle
70
+ // leap years and caused no harm to almost all date calculations in Lotus 1-2-3.
71
+ //
72
+ // When Microsoft Multiplan and Microsoft Excel were released, they also assumed that 1900
73
+ // was a leap year. This assumption allowed Microsoft Multiplan and Microsoft Excel to use
74
+ // the same serial date system used by Lotus 1-2-3 and provide greater compatibility with Lotus 1-2-3.
75
+ // Treating 1900 as a leap year also made it easier for users to move worksheets from one program
76
+ // to the other".
77
+ //
78
+ // So the historical bug is basically that Excel thinks that February 29th, 1900 existed
79
+ // while in reality it didn't. That's why it's actually 1 day off for any date after that one.
80
+ //
81
+ var NUMBER_OF_LEAP_YEARS_BETWEEN_1900_AND_1970 = 17;
82
+ var JANUARY_0TH_1900_DAY = 1;
83
+ var ERRONEOUS_FEBRUARY_29_1990_DAY = 1;
84
+
85
+ // An approximate count of seconds in a day is:
86
+ // 24 hours * 60 minutes in an hour * 60 seconds in a minute
87
+ //
88
+ // It is approximate because a minute could be longer than 60 seconds, due to "leap seconds".
89
+ //
90
+ // Still, javascript `Date`, and UNIX time in general, intentionally
91
+ // drop the concept of "leap seconds" in order to make things simpler.
92
+ // So this approximation is valid and doesn't result in any bugs.
93
+ // https://stackoverflow.com/questions/53019726/where-are-the-leap-seconds-in-javascript
94
+ //
95
+ // "The JavaScript Date object specifically adheres to the concept of Unix Time
96
+ // (albeit with higher precision). This is part of the POSIX specification,
97
+ // and thus is sometimes called "POSIX Time". It does not count leap seconds,
98
+ // but rather assumes every day had exactly 86,400 seconds. You can read about
99
+ // this in section 20.3.1.1 of the current ECMAScript specification, which states:
100
+ //
101
+ // "Time is measured in ECMAScript in milliseconds since 01 January, 1970 UTC.
102
+ // In time values leap seconds are ignored. It is assumed that there are exactly
103
+ // 86,400,000 milliseconds per day."
104
+ //
105
+ // The reason is that the unpredictable nature of leap seconds makes them very
106
+ // difficult to work with in APIs. One can't generally pass timestamps around
107
+ // that need leap seconds tables to be interpreted correctly, and expect that
108
+ // one system will interpret them the same as another. For example, a timestamp
109
+ // `1483228826` that accounts for "leap seconds" should've been interpreted as
110
+ // "2017-01-01T00:00:00Z", but if the receiver doesn't account for "leap seconds",
111
+ // they would interpret it as "2017-01-01T00:00:26Z" (e.g. POSIX-based systems like Linux),
112
+ // So "leap seconds" aren't really portable.
113
+ // Even on systems that have full frequently-updated "leap second" tables,
114
+ // there's no telling what adjustments those tables will contain in the future
115
+ // (i.e. beyond the 6-month IERS announcement period) because "leap seconds" can't be
116
+ // determined by a fixed mathematical formula or something like that. Instead,
117
+ // scientists introduce them as needed based on the observed Earth's rotation around the sun.
118
+ //
119
+ // "Because the Earth's rotational speed varies in response to climatic and geological events,
120
+ // UTC leap seconds are irregularly spaced and not precisely predictable. The decision to insert
121
+ // a leap second is made by the International Earth Rotation and Reference Systems Service (IERS),
122
+ // typically about six months in advance, to ensure that the difference between UTC and UT1
123
+ // does not exceed ±0.9 seconds."
124
+ //
125
+ // One example is year `1900` which is "every fourth year" but it still is not a "leap year".
126
+ //
127
+ // To reiterate: to support leap seconds in a programming language, the implementation
128
+ // must go out of its way to do so, and must make tradeoffs that are not always acceptable.
129
+ // Though there are exceptions, the general position is to not support them - not because
130
+ // of any subversion or active countermeasures, but because supporting them properly is much,
131
+ // much harder.
132
+ //
133
+ // https://en.wikipedia.org/wiki/Unix_time#Leap_seconds
134
+ // https://en.wikipedia.org/wiki/Leap_year
135
+ // https://en.wikipedia.org/wiki/Leap_second
136
+ //
137
+ var DAY = 24 * 60 * 60 * 1000;
138
+ var DAYS_IN_YEAR = 365;
139
+ //# sourceMappingURL=parseExcelDate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseExcelDate.js","names":["parseExcelDate","excelSerialDate","options","epoch1904","DAYS_IN_YEAR","JANUARY_0TH_1900_DAY","ERRONEOUS_FEBRUARY_29_1990_DAY","daysBeforeUnixEpoch","NUMBER_OF_LEAP_YEARS_BETWEEN_1900_AND_1970","Date","Math","floor","DAY"],"sources":["../../source/xlsx/parseExcelDate.js"],"sourcesContent":["// Parses an Excel Date (represented by a \"serial\" floating-point number)\r\n// into a javascript `Date` in UTC+0 timezone (with time is set to 00:00).\r\n//\r\n// https://www.pcworld.com/article/3063622/software/mastering-excel-date-time-serial-numbers-networkdays-datevalue-and-more.html\r\n// \"If you need to calculate dates in your spreadsheets,\r\n// Excel uses its own unique system, which it calls Serial Numbers\".\r\n//\r\nexport default function parseExcelDate(excelSerialDate, options) {\r\n // Windows operating system uses floating-point numbers to represent dates,\r\n // where the number represents the count of days elapsed since January 0th, 1900.\r\n //\r\n // This also means that there're 2 aspects associated with this choice:\r\n //\r\n // * January 1st, 1900, 00:00 is represented by `1` rather than `0`, which looks a bit weird.\r\n // * 1900 is a special year because it's a \"one in a 100 years\" occasion when it's not a leap year.\r\n //\r\n // To work around those two aspects, Mac OS chose another baseline — January 1st, 1900.\r\n // Although, that only postponed the second issue because 2100 is going to be the next \"speciaL\" year\r\n // which is not going to be a \"leap\" one.\r\n //\r\n // Older versions of Excel on Mac OS used year 1904 as the default baseline for numeric dates.\r\n // Since 2011, Microsoft Excel on Mac OS uses year 1900 as the default baseline for cross-platform consistency.\r\n // https://support.microsoft.com/en-us/office/date-systems-in-excel-e7fe7167-48a9-4b96-bb53-5612a800b487\r\n //\r\n // So the 1904 baseline is now deprecated, although still available to be configured manually.\r\n // So it still might be encountered in Excel files created on MacOS.\r\n // In that case, the Excel file contains a special flag — `<workbook><workbookPr date1904=\"1\"/>...` —\r\n // that tells the application which baseline is being used for numeric date timestamps.\r\n //\r\n if (options && options.epoch1904) {\r\n // Convert the numeric date timestamp from 1904 baseline to 1900 baseline.\r\n excelSerialDate += (1904 - 1900) * DAYS_IN_YEAR + JANUARY_0TH_1900_DAY + ERRONEOUS_FEBRUARY_29_1990_DAY\r\n }\r\n\r\n const daysBeforeUnixEpoch = JANUARY_0TH_1900_DAY + ERRONEOUS_FEBRUARY_29_1990_DAY + (1970 - 1900) * DAYS_IN_YEAR + NUMBER_OF_LEAP_YEARS_BETWEEN_1900_AND_1970\r\n\r\n return new Date(Math.floor((excelSerialDate - daysBeforeUnixEpoch) * DAY))\r\n}\r\n\r\n// \"Excel serial date\" is just a (fractional) count of days passed since `00/01/1900`.\r\n//\r\n// In contrast, \"Unix timestamps\" use `01/01/1970` as the baseline for numeric dates.\r\n//\r\n// In order to convert one into another, it should calculate the count of days elapsed\r\n// since `00/01/1900` (Excel epoch) till `01/01/1970` (Unix epoch), or the count of days\r\n// between year `1900` and year `1970`, plus one day.\r\n//\r\n// It also should account for the number of \"leap years\" between year `1900` and year `1970`,\r\n// which is 17 of them. https://kalender-365.de/leap-years.php\r\n//\r\n// \"One year has the length of 365 days, 5 hours, 48 minutes and 45 seconds.\r\n// These are 365.2421875 days. This is hard to calculate with, so for practical reasons\r\n// a normal year has been given 365 days and a leap year 366 days. In leap years,\r\n// February 29th is added as leap day, which doesn't exist in a normal year.\r\n// A leap year is every 4 years, but not every 100 years, then again every 400 years.\r\n// So the year 1900 wasn't a leap year, but 2000 was\".\r\n//\r\n// And also, Excel has a historical bug when it incorrectly assumes year `1900` to be a leap year,\r\n// and, as a result, all Excel serial dates starting from March 1st, 1900 lag 1 day behind\r\n// and require an additional 1 day to be added to them in order to be converted to a proper timestamp.\r\n//\r\n// https://learn.microsoft.com/en-us/answers/questions/5249322/why-does-microsoft-excel-considers-29-02-1900-to-b?forum=msoffice-all&referrer=answers#:~:text=This%20made%20it%20easier%20for,other%20programs%20that%20use%20dates.\r\n//\r\n// \"When Lotus 1-2-3 was first released, the program assumed that the year 1900 was a leap year,\r\n// even though it actually was not a leap year. This made it easier for the program to handle\r\n// leap years and caused no harm to almost all date calculations in Lotus 1-2-3.\r\n//\r\n// When Microsoft Multiplan and Microsoft Excel were released, they also assumed that 1900\r\n// was a leap year. This assumption allowed Microsoft Multiplan and Microsoft Excel to use\r\n// the same serial date system used by Lotus 1-2-3 and provide greater compatibility with Lotus 1-2-3.\r\n// Treating 1900 as a leap year also made it easier for users to move worksheets from one program\r\n// to the other\".\r\n//\r\n// So the historical bug is basically that Excel thinks that February 29th, 1900 existed\r\n// while in reality it didn't. That's why it's actually 1 day off for any date after that one.\r\n//\r\nconst NUMBER_OF_LEAP_YEARS_BETWEEN_1900_AND_1970 = 17\r\nconst JANUARY_0TH_1900_DAY = 1\r\nconst ERRONEOUS_FEBRUARY_29_1990_DAY = 1\r\n\r\n// An approximate count of seconds in a day is:\r\n// 24 hours * 60 minutes in an hour * 60 seconds in a minute\r\n//\r\n// It is approximate because a minute could be longer than 60 seconds, due to \"leap seconds\".\r\n//\r\n// Still, javascript `Date`, and UNIX time in general, intentionally\r\n// drop the concept of \"leap seconds\" in order to make things simpler.\r\n// So this approximation is valid and doesn't result in any bugs.\r\n// https://stackoverflow.com/questions/53019726/where-are-the-leap-seconds-in-javascript\r\n//\r\n// \"The JavaScript Date object specifically adheres to the concept of Unix Time\r\n// (albeit with higher precision). This is part of the POSIX specification,\r\n// and thus is sometimes called \"POSIX Time\". It does not count leap seconds,\r\n// but rather assumes every day had exactly 86,400 seconds. You can read about\r\n// this in section 20.3.1.1 of the current ECMAScript specification, which states:\r\n//\r\n// \"Time is measured in ECMAScript in milliseconds since 01 January, 1970 UTC.\r\n// In time values leap seconds are ignored. It is assumed that there are exactly\r\n// 86,400,000 milliseconds per day.\"\r\n//\r\n// The reason is that the unpredictable nature of leap seconds makes them very\r\n// difficult to work with in APIs. One can't generally pass timestamps around\r\n// that need leap seconds tables to be interpreted correctly, and expect that\r\n// one system will interpret them the same as another. For example, a timestamp\r\n// `1483228826` that accounts for \"leap seconds\" should've been interpreted as\r\n// \"2017-01-01T00:00:00Z\", but if the receiver doesn't account for \"leap seconds\",\r\n// they would interpret it as \"2017-01-01T00:00:26Z\" (e.g. POSIX-based systems like Linux),\r\n// So \"leap seconds\" aren't really portable.\r\n// Even on systems that have full frequently-updated \"leap second\" tables,\r\n// there's no telling what adjustments those tables will contain in the future\r\n// (i.e. beyond the 6-month IERS announcement period) because \"leap seconds\" can't be\r\n// determined by a fixed mathematical formula or something like that. Instead,\r\n// scientists introduce them as needed based on the observed Earth's rotation around the sun.\r\n//\r\n// \"Because the Earth's rotational speed varies in response to climatic and geological events,\r\n// UTC leap seconds are irregularly spaced and not precisely predictable. The decision to insert\r\n// a leap second is made by the International Earth Rotation and Reference Systems Service (IERS),\r\n// typically about six months in advance, to ensure that the difference between UTC and UT1\r\n// does not exceed ±0.9 seconds.\"\r\n//\r\n// One example is year `1900` which is \"every fourth year\" but it still is not a \"leap year\".\r\n//\r\n// To reiterate: to support leap seconds in a programming language, the implementation\r\n// must go out of its way to do so, and must make tradeoffs that are not always acceptable.\r\n// Though there are exceptions, the general position is to not support them - not because\r\n// of any subversion or active countermeasures, but because supporting them properly is much,\r\n// much harder.\r\n//\r\n// https://en.wikipedia.org/wiki/Unix_time#Leap_seconds\r\n// https://en.wikipedia.org/wiki/Leap_year\r\n// https://en.wikipedia.org/wiki/Leap_second\r\n//\r\nconst DAY = 24 * 60 * 60 * 1000\r\nconst DAYS_IN_YEAR = 365\r\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,cAAcA,CAACC,eAAe,EAAEC,OAAO,EAAE;EAC/D;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,IAAIA,OAAO,IAAIA,OAAO,CAACC,SAAS,EAAE;IAChC;IACAF,eAAe,IAAI,CAAC,IAAI,GAAG,IAAI,IAAIG,YAAY,GAAGC,oBAAoB,GAAGC,8BAA8B;EACzG;EAEA,IAAMC,mBAAmB,GAAGF,oBAAoB,GAAGC,8BAA8B,GAAG,CAAC,IAAI,GAAG,IAAI,IAAIF,YAAY,GAAGI,0CAA0C;EAE7J,OAAO,IAAIC,IAAI,CAACC,IAAI,CAACC,KAAK,CAAC,CAACV,eAAe,GAAGM,mBAAmB,IAAIK,GAAG,CAAC,CAAC;AAC5E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMJ,0CAA0C,GAAG,EAAE;AACrD,IAAMH,oBAAoB,GAAG,CAAC;AAC9B,IAAMC,8BAA8B,GAAG,CAAC;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMM,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;AAC/B,IAAMR,YAAY,GAAG,GAAG"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseExcelDate.test.js","names":["_mocha","require","_chai","_parseExcelDate","_interopRequireDefault","obj","__esModule","describe","it","date","Date","UTC","expect","parseExcelDate","getTime","to","equal","DAYS_BETWEEN_1900_EPOCH_AND_1904_EPOCH","epoch1904"],"sources":["../../source/xlsx/parseExcelDate.test.js"],"sourcesContent":["import { describe, it } from 'mocha'\r\nimport { expect } from 'chai'\r\n\r\nimport parseExcelDate from './parseExcelDate.js'\r\n\r\ndescribe('parseExcelDate', () => {\r\n\tit('should parse Excel \"serial\" dates', () => {\r\n\t\tconst date = new Date(Date.UTC(2018, 3 - 1, 24))\r\n // Excel stores dates as integers.\r\n // E.g. '24/03/2018' === 43183\r\n\t\texpect(parseExcelDate(43183).getTime()).to.equal(date.getTime())\r\n\t})\r\n\r\n\tit('should parse Excel \"serial\" dates (1904 baseline)', () => {\r\n\t\tconst date = new Date(Date.UTC(2018, 3 - 1, 24))\r\n // Excel stores dates as integers.\r\n // E.g. '24/03/2018' === 43183\r\n\t\tconst DAYS_BETWEEN_1900_EPOCH_AND_1904_EPOCH = 1462\r\n\t\texpect(parseExcelDate(43183 - DAYS_BETWEEN_1900_EPOCH_AND_1904_EPOCH, { epoch1904: true }).getTime()).to.equal(date.getTime())\r\n\t})\r\n})\r\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,eAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAgD,SAAAG,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAEhD,IAAAE,eAAQ,EAAC,gBAAgB,EAAE,YAAM;EAChC,IAAAC,SAAE,EAAC,mCAAmC,EAAE,YAAM;IAC7C,IAAMC,IAAI,GAAG,IAAIC,IAAI,CAACA,IAAI,CAACC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9C;IACA;IACF,IAAAC,YAAM,EAAC,IAAAC,0BAAc,EAAC,KAAK,CAAC,CAACC,OAAO,CAAC,CAAC,CAAC,CAACC,EAAE,CAACC,KAAK,CAACP,IAAI,CAACK,OAAO,CAAC,CAAC,CAAC;EACjE,CAAC,CAAC;EAEF,IAAAN,SAAE,EAAC,mDAAmD,EAAE,YAAM;IAC7D,IAAMC,IAAI,GAAG,IAAIC,IAAI,CAACA,IAAI,CAACC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9C;IACA;IACF,IAAMM,sCAAsC,GAAG,IAAI;IACnD,IAAAL,YAAM,EAAC,IAAAC,0BAAc,EAAC,KAAK,GAAGI,sCAAsC,EAAE;MAAEC,SAAS,EAAE;IAAK,CAAC,CAAC,CAACJ,OAAO,CAAC,CAAC,CAAC,CAACC,EAAE,CAACC,KAAK,CAACP,IAAI,CAACK,OAAO,CAAC,CAAC,CAAC;EAC/H,CAAC,CAAC;AACH,CAAC,CAAC"}
@@ -5,19 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = parseSheet;
7
7
  var _parseCells = _interopRequireDefault(require("./parseCells.js"));
8
- var _parseDimensions = _interopRequireDefault(require("./parseDimensions.js"));
9
- var _coordinates = require("./coordinates.js");
8
+ var _parseSheetDimensions = _interopRequireDefault(require("./parseSheetDimensions.js"));
9
+ var _reconstructSheetDimensionsFromSheetCells = _interopRequireDefault(require("./reconstructSheetDimensionsFromSheetCells.js"));
10
+ var _convertCellsToData2dArray = _interopRequireDefault(require("./convertCellsToData2dArray.js"));
10
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
- function parseSheet(content, xml, values, styles, properties, options) {
12
- var sheet = xml.createDocument(content);
13
- var cells = (0, _parseCells["default"])(sheet, xml, values, styles, properties, options);
12
+ function parseSheet(content, xml, sharedStrings, styles, epoch1904, options) {
13
+ var sheetDocument = xml.createDocument(content);
14
+ var cells = (0, _parseCells["default"])(sheetDocument, sharedStrings, styles, epoch1904, options);
14
15
 
15
- // `dimensions` defines the spreadsheet area containing all non-empty cells.
16
+ // `dimensions` defines the spreadsheet area enclosing all non-empty cells.
16
17
  // https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sheetdimension?view=openxml-2.8.1
17
- var dimensions = (0, _parseDimensions["default"])(sheet) || (0, _coordinates.calculateDimensions)(cells);
18
- return {
19
- cells: cells,
20
- dimensions: dimensions
21
- };
18
+ var dimensions = (0, _parseSheetDimensions["default"])(sheetDocument) || (0, _reconstructSheetDimensionsFromSheetCells["default"])(cells);
19
+ return (0, _convertCellsToData2dArray["default"])(cells, dimensions);
22
20
  }
23
21
  //# sourceMappingURL=parseSheet.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"parseSheet.js","names":["_parseCells","_interopRequireDefault","require","_parseDimensions","_coordinates","obj","__esModule","parseSheet","content","xml","values","styles","properties","options","sheet","createDocument","cells","parseCells","dimensions","parseDimensions","calculateDimensions"],"sources":["../../source/xlsx/parseSheet.js"],"sourcesContent":["import parseCells from './parseCells.js'\r\nimport parseDimensions from './parseDimensions.js'\r\n\r\nimport { calculateDimensions } from './coordinates.js'\r\n\r\nexport default function parseSheet(content, xml, values, styles, properties, options) {\r\n const sheet = xml.createDocument(content)\r\n\r\n const cells = parseCells(sheet, xml, values, styles, properties, options)\r\n\r\n // `dimensions` defines the spreadsheet area containing all non-empty cells.\r\n // https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sheetdimension?view=openxml-2.8.1\r\n const dimensions = parseDimensions(sheet) || calculateDimensions(cells)\r\n\r\n return { cells, dimensions }\r\n}"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AAAsD,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAEvC,SAASE,UAAUA,CAACC,OAAO,EAAEC,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAE;EACpF,IAAMC,KAAK,GAAGL,GAAG,CAACM,cAAc,CAACP,OAAO,CAAC;EAEzC,IAAMQ,KAAK,GAAG,IAAAC,sBAAU,EAACH,KAAK,EAAEL,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,OAAO,CAAC;;EAEzE;EACA;EACA,IAAMK,UAAU,GAAG,IAAAC,2BAAe,EAACL,KAAK,CAAC,IAAI,IAAAM,gCAAmB,EAACJ,KAAK,CAAC;EAEvE,OAAO;IAAEA,KAAK,EAALA,KAAK;IAAEE,UAAU,EAAVA;EAAW,CAAC;AAC9B"}
1
+ {"version":3,"file":"parseSheet.js","names":["_parseCells","_interopRequireDefault","require","_parseSheetDimensions","_reconstructSheetDimensionsFromSheetCells","_convertCellsToData2dArray","obj","__esModule","parseSheet","content","xml","sharedStrings","styles","epoch1904","options","sheetDocument","createDocument","cells","parseCells","dimensions","parseSheetDimensions","reconstructSheetDimensionsFromSheetCells","convertSheetToData2dArray"],"sources":["../../source/xlsx/parseSheet.js"],"sourcesContent":["import parseCells from './parseCells.js'\r\nimport parseSheetDimensions from './parseSheetDimensions.js'\r\nimport reconstructSheetDimensionsFromSheetCells from './reconstructSheetDimensionsFromSheetCells.js'\r\nimport convertSheetToData2dArray from './convertCellsToData2dArray.js'\r\n\r\nexport default function parseSheet(content, xml, sharedStrings, styles, epoch1904, options) {\r\n const sheetDocument = xml.createDocument(content)\r\n\r\n const cells = parseCells(sheetDocument, sharedStrings, styles, epoch1904, options)\r\n\r\n // `dimensions` defines the spreadsheet area enclosing all non-empty cells.\r\n // https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sheetdimension?view=openxml-2.8.1\r\n const dimensions = parseSheetDimensions(sheetDocument) || reconstructSheetDimensionsFromSheetCells(cells)\r\n\r\n return convertSheetToData2dArray(cells, dimensions)\r\n}"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,yCAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,0BAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAAsE,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAEvD,SAASE,UAAUA,CAACC,OAAO,EAAEC,GAAG,EAAEC,aAAa,EAAEC,MAAM,EAAEC,SAAS,EAAEC,OAAO,EAAE;EAC1F,IAAMC,aAAa,GAAGL,GAAG,CAACM,cAAc,CAACP,OAAO,CAAC;EAEjD,IAAMQ,KAAK,GAAG,IAAAC,sBAAU,EAACH,aAAa,EAAEJ,aAAa,EAAEC,MAAM,EAAEC,SAAS,EAAEC,OAAO,CAAC;;EAElF;EACA;EACA,IAAMK,UAAU,GAAG,IAAAC,gCAAoB,EAACL,aAAa,CAAC,IAAI,IAAAM,oDAAwC,EAACJ,KAAK,CAAC;EAEzG,OAAO,IAAAK,qCAAyB,EAACL,KAAK,EAAEE,UAAU,CAAC;AACrD"}
@@ -3,9 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports["default"] = parseDimensions;
7
- var _coordinates = require("./coordinates.js");
6
+ exports["default"] = parseSheetDimensions;
7
+ var _parseCellCoordinates = _interopRequireDefault(require("./parseCellCoordinates.js"));
8
8
  var _xlsx = require("../xml/xlsx.js");
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
9
10
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
11
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
12
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -14,10 +15,10 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
14
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15
16
  // `dimensions` defines the spreadsheet area containing all non-empty cells.
16
17
  // https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sheetdimension?view=openxml-2.8.1
17
- function parseDimensions(sheet) {
18
- var dimensions = (0, _xlsx.getDimensions)(sheet);
18
+ function parseSheetDimensions(sheetDocument) {
19
+ var dimensions = (0, _xlsx.getDimensions)(sheetDocument);
19
20
  if (dimensions) {
20
- dimensions = dimensions.split(':').map(_coordinates.parseCellCoordinates).map(function (_ref) {
21
+ dimensions = dimensions.split(':').map(_parseCellCoordinates["default"]).map(function (_ref) {
21
22
  var _ref2 = _slicedToArray(_ref, 2),
22
23
  row = _ref2[0],
23
24
  column = _ref2[1];
@@ -39,4 +40,4 @@ function parseDimensions(sheet) {
39
40
  return dimensions;
40
41
  }
41
42
  }
42
- //# sourceMappingURL=parseDimensions.js.map
43
+ //# sourceMappingURL=parseSheetDimensions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseSheetDimensions.js","names":["_parseCellCoordinates","_interopRequireDefault","require","_xlsx","obj","__esModule","_slicedToArray","arr","i","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","o","minLen","_arrayLikeToArray","n","Object","prototype","toString","call","slice","constructor","name","Array","from","test","len","length","arr2","r","l","t","Symbol","iterator","e","u","a","f","next","done","push","value","isArray","parseSheetDimensions","sheetDocument","dimensions","getDimensions","split","map","parseCellCoordinates","_ref","_ref2","row","column"],"sources":["../../source/xlsx/parseSheetDimensions.js"],"sourcesContent":["import parseCellCoordinates from './parseCellCoordinates.js'\r\n\r\nimport { getDimensions } from '../xml/xlsx.js'\r\n\r\n// `dimensions` defines the spreadsheet area containing all non-empty cells.\r\n// https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sheetdimension?view=openxml-2.8.1\r\nexport default function parseSheetDimensions(sheetDocument) {\r\n let dimensions = getDimensions(sheetDocument)\r\n if (dimensions) {\r\n dimensions = dimensions.split(':').map(parseCellCoordinates).map(([row, column]) => ({\r\n row,\r\n column\r\n }))\r\n // Sometimes there can be just a single cell as a spreadsheet's \"dimensions\".\r\n // For example, the default \"dimensions\" in Apache POI library is \"A1\",\r\n // meaning that only the first cell in the spreadsheet is used.\r\n //\r\n // A quote from Apache POI library:\r\n // \"Single cell ranges are formatted like single cell references (e.g. 'A1' instead of 'A1:A1').\"\r\n //\r\n if (dimensions.length === 1) {\r\n dimensions = [dimensions[0], dimensions[0]]\r\n }\r\n return dimensions\r\n }\r\n}\r\n"],"mappings":";;;;;;AAAA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AAA8C,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAAA,SAAAE,eAAAC,GAAA,EAAAC,CAAA,WAAAC,eAAA,CAAAF,GAAA,KAAAG,qBAAA,CAAAH,GAAA,EAAAC,CAAA,KAAAG,2BAAA,CAAAJ,GAAA,EAAAC,CAAA,KAAAI,gBAAA;AAAA,SAAAA,iBAAA,cAAAC,SAAA;AAAA,SAAAF,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CAAAI,IAAA,CAAAN,CAAA,CAAAO,KAAA,GAAAL,CAAA,CAAAT,MAAA,KAAAG,CAAA,GAAAO,CAAA,iBAAAR,CAAA,IAAAjB,CAAA,OAAAG,CAAA,GAAAc,CAAA,yBAAAQ,CAAA,YAAAN,CAAA,eAAAI,CAAA,GAAAJ,CAAA,cAAAf,MAAA,CAAAmB,CAAA,MAAAA,CAAA,2BAAAvB,CAAA,QAAAG,CAAA,aAAAqB,CAAA;AAAA,SAAA7B,gBAAAF,GAAA,QAAAkB,KAAA,CAAAmB,OAAA,CAAArC,GAAA,UAAAA,GAAA;AAE9C;AACA;AACe,SAASsC,oBAAoBA,CAACC,aAAa,EAAE;EAC1D,IAAIC,UAAU,GAAG,IAAAC,mBAAa,EAACF,aAAa,CAAC;EAC7C,IAAIC,UAAU,EAAE;IACdA,UAAU,GAAGA,UAAU,CAACE,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,gCAAoB,CAAC,CAACD,GAAG,CAAC,UAAAE,IAAA;MAAA,IAAAC,KAAA,GAAA/C,cAAA,CAAA8C,IAAA;QAAEE,GAAG,GAAAD,KAAA;QAAEE,MAAM,GAAAF,KAAA;MAAA,OAAO;QACnFC,GAAG,EAAHA,GAAG;QACHC,MAAM,EAANA;MACF,CAAC;IAAA,CAAC,CAAC;IACH;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAIR,UAAU,CAAClB,MAAM,KAAK,CAAC,EAAE;MAC3BkB,UAAU,GAAG,CAACA,UAAU,CAAC,CAAC,CAAC,EAAEA,UAAU,CAAC,CAAC,CAAC,CAAC;IAC7C;IACA,OAAOA,UAAU;EACnB;AACF"}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = parseSpreadsheetContents;
7
+ var _parseSpreadsheetInfo2 = _interopRequireDefault(require("./parseSpreadsheetInfo.js"));
8
+ var _parseFilePaths = _interopRequireDefault(require("./parseFilePaths.js"));
9
+ var _parseStyles = _interopRequireDefault(require("./parseStyles.js"));
10
+ var _parseSharedStrings = _interopRequireDefault(require("./parseSharedStrings.js"));
11
+ var _parseSheet = _interopRequireDefault(require("./parseSheet.js"));
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
14
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
15
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
16
+ // For an introduction in reading `.xlsx` files see "The minimum viable XLSX reader":
17
+ // https://www.brendanlong.com/the-minimum-viable-xlsx-reader.html
18
+ /**
19
+ * Reads data from an `.xlsx` file.
20
+ * @param {Record<string,string>} contents - A map of `.xml` files inside the `.xlsx` file (which itself is just a zipped directory).
21
+ * @param {object} xml — An object having a single property — `createDocument(string)` function.
22
+ * @param {object} [options]
23
+ * @return {ReadFileResult}
24
+ */
25
+ function parseSpreadsheetContents(contents, xml) {
26
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
27
+ var getFileContent = function getFileContent(filePath) {
28
+ if (!contents[filePath]) {
29
+ throw new Error("\"".concat(filePath, "\" file not found inside the *.xlsx file zip archive"));
30
+ }
31
+ return contents[filePath];
32
+ };
33
+
34
+ // Read the paths to certain files inside the `.xlsx` file, which is itself just a `.zip` archive.
35
+ // These paths aren't standardized between different spreadsheet editors.
36
+ // https://github.com/tidyverse/readxl/issues/104
37
+ var filePaths = (0, _parseFilePaths["default"])(getFileContent('xl/_rels/workbook.xml.rels'), xml);
38
+
39
+ // The usual file path for "shared strings" is "xl/sharedStrings.xml".
40
+ var sharedStrings = filePaths.sharedStrings ? (0, _parseSharedStrings["default"])(getFileContent(filePaths.sharedStrings), xml) : [];
41
+
42
+ // The usual file path for "styles" is "xl/styles.xml".
43
+ var styles = filePaths.styles ? (0, _parseStyles["default"])(getFileContent(filePaths.styles), xml) : {};
44
+ var _parseSpreadsheetInfo = (0, _parseSpreadsheetInfo2["default"])(getFileContent('xl/workbook.xml'), xml),
45
+ sheets = _parseSpreadsheetInfo.sheets,
46
+ epoch1904 = _parseSpreadsheetInfo.epoch1904;
47
+ var sheetIdsToRead = options.sheets && options.sheets.map(function (sheet) {
48
+ return getSheetId(sheet, sheets);
49
+ });
50
+
51
+ // Parse sheets data.
52
+
53
+ var sheetsData = [];
54
+ for (var _i = 0, _Object$keys = Object.keys(filePaths.sheets); _i < _Object$keys.length; _i++) {
55
+ var sheetId = _Object$keys[_i];
56
+ if (sheetIdsToRead && !sheetIdsToRead.includes(sheetId)) {
57
+ continue;
58
+ }
59
+ sheetsData.push({
60
+ sheet: getSheetNameById(sheetId, sheets),
61
+ data: (0, _parseSheet["default"])(getFileContent(filePaths.sheets[sheetId]), xml, sharedStrings, styles, epoch1904, options)
62
+ });
63
+ }
64
+
65
+ // Return spreadsheet data.
66
+ return sheetsData;
67
+ }
68
+ function getSheetId(sheet, sheets) {
69
+ if (typeof sheet === 'string') {
70
+ for (var _iterator = _createForOfIteratorHelperLoose(sheets), _step; !(_step = _iterator()).done;) {
71
+ var _sheet = _step.value;
72
+ if (_sheet.name === sheet) {
73
+ return _sheet.relationId;
74
+ }
75
+ }
76
+ throw new Error("Sheet \"".concat(sheet, "\" not found. Available sheets: ").concat(sheets.map(function (_ref) {
77
+ var name = _ref.name;
78
+ return "\"".concat(name, "\"");
79
+ }).join(', ')));
80
+ } else {
81
+ if (sheet <= sheets.length) {
82
+ return sheets[sheet - 1].relationId;
83
+ }
84
+ throw new Error("Sheet number out of bounds: ".concat(sheet, ". Available sheets count: ").concat(sheets.length));
85
+ }
86
+ }
87
+ function getSheetNameById(sheetId, sheets) {
88
+ for (var _iterator2 = _createForOfIteratorHelperLoose(sheets), _step2; !(_step2 = _iterator2()).done;) {
89
+ var sheet = _step2.value;
90
+ if (sheet.relationId === sheetId) {
91
+ return sheet.name;
92
+ }
93
+ }
94
+ throw new Error("Sheet ID not found: ".concat(sheetId));
95
+ }
96
+ //# sourceMappingURL=parseSpreadsheetContents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseSpreadsheetContents.js","names":["_parseSpreadsheetInfo2","_interopRequireDefault","require","_parseFilePaths","_parseStyles","_parseSharedStrings","_parseSheet","obj","__esModule","_createForOfIteratorHelperLoose","o","allowArrayLike","it","Symbol","iterator","call","next","bind","Array","isArray","_unsupportedIterableToArray","length","i","done","value","TypeError","minLen","_arrayLikeToArray","n","Object","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","parseSpreadsheetContents","contents","xml","options","arguments","undefined","getFileContent","filePath","Error","concat","filePaths","parseFilePaths","sharedStrings","parseSharedStrings","styles","parseStyles","_parseSpreadsheetInfo","parseSpreadsheetInfo","sheets","epoch1904","sheetIdsToRead","map","sheet","getSheetId","sheetsData","_i","_Object$keys","keys","sheetId","includes","push","getSheetNameById","data","parseSheet","_iterator","_step","_sheet","relationId","_ref","join","_iterator2","_step2"],"sources":["../../source/xlsx/parseSpreadsheetContents.js"],"sourcesContent":["import parseSpreadsheetInfo from './parseSpreadsheetInfo.js'\r\nimport parseFilePaths from './parseFilePaths.js'\r\nimport parseStyles from './parseStyles.js'\r\nimport parseSharedStrings from './parseSharedStrings.js'\r\nimport parseSheet from './parseSheet.js'\r\n\r\n// For an introduction in reading `.xlsx` files see \"The minimum viable XLSX reader\":\r\n// https://www.brendanlong.com/the-minimum-viable-xlsx-reader.html\r\n\r\n/**\r\n * Reads data from an `.xlsx` file.\r\n * @param {Record<string,string>} contents - A map of `.xml` files inside the `.xlsx` file (which itself is just a zipped directory).\r\n * @param {object} xml — An object having a single property — `createDocument(string)` function.\r\n * @param {object} [options]\r\n * @return {ReadFileResult}\r\n */\r\nexport default function parseSpreadsheetContents(contents, xml, options = {}) {\r\n const getFileContent = (filePath) => {\r\n if (!contents[filePath]) {\r\n throw new Error(`\"${filePath}\" file not found inside the *.xlsx file zip archive`)\r\n }\r\n return contents[filePath]\r\n }\r\n\r\n // Read the paths to certain files inside the `.xlsx` file, which is itself just a `.zip` archive.\r\n // These paths aren't standardized between different spreadsheet editors.\r\n // https://github.com/tidyverse/readxl/issues/104\r\n const filePaths = parseFilePaths(getFileContent('xl/_rels/workbook.xml.rels'), xml)\r\n\r\n // The usual file path for \"shared strings\" is \"xl/sharedStrings.xml\".\r\n const sharedStrings = filePaths.sharedStrings\r\n ? parseSharedStrings(getFileContent(filePaths.sharedStrings), xml)\r\n : []\r\n\r\n // The usual file path for \"styles\" is \"xl/styles.xml\".\r\n const styles = filePaths.styles\r\n ? parseStyles(getFileContent(filePaths.styles), xml)\r\n : {}\r\n\r\n const { sheets, epoch1904 } = parseSpreadsheetInfo(getFileContent('xl/workbook.xml'), xml)\r\n\r\n const sheetIdsToRead = options.sheets && options.sheets.map(sheet => getSheetId(sheet, sheets))\r\n\r\n // Parse sheets data.\r\n\r\n const sheetsData = []\r\n\r\n for (const sheetId of Object.keys(filePaths.sheets)) {\r\n if (sheetIdsToRead && !sheetIdsToRead.includes(sheetId)) {\r\n continue\r\n }\r\n\r\n sheetsData.push({\r\n sheet: getSheetNameById(sheetId, sheets),\r\n data: parseSheet(\r\n getFileContent(filePaths.sheets[sheetId]),\r\n xml,\r\n sharedStrings,\r\n styles,\r\n epoch1904,\r\n options\r\n )\r\n })\r\n }\r\n\r\n // Return spreadsheet data.\r\n return sheetsData\r\n}\r\n\r\nfunction getSheetId(sheet, sheets) {\r\n if (typeof sheet === 'string') {\r\n for (const _sheet of sheets) {\r\n if (_sheet.name === sheet) {\r\n return _sheet.relationId\r\n }\r\n }\r\n\t\tthrow new Error(`Sheet \"${sheet}\" not found. Available sheets: ${sheets.map(({ name }) => `\"${name}\"`).join(', ')}`)\r\n } else {\r\n\t\tif (sheet <= sheets.length) {\r\n return sheets[sheet - 1].relationId\r\n }\r\n throw new Error(`Sheet number out of bounds: ${sheet}. Available sheets count: ${sheets.length}`)\r\n }\r\n}\r\n\r\nfunction getSheetNameById(sheetId, sheets) {\r\n for (const sheet of sheets) {\r\n if (sheet.relationId === sheetId) {\r\n return sheet.name\r\n }\r\n }\r\n throw new Error(`Sheet ID not found: ${sheetId}`)\r\n}"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,WAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAwC,SAAAD,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAAA,SAAAE,gCAAAC,CAAA,EAAAC,cAAA,QAAAC,EAAA,UAAAC,MAAA,oBAAAH,CAAA,CAAAG,MAAA,CAAAC,QAAA,KAAAJ,CAAA,oBAAAE,EAAA,UAAAA,EAAA,GAAAA,EAAA,CAAAG,IAAA,CAAAL,CAAA,GAAAM,IAAA,CAAAC,IAAA,CAAAL,EAAA,OAAAM,KAAA,CAAAC,OAA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,gCAAAb,MAAA,CAA6BS,MAAM,CAACrC,MAAM,CAAE,CAAC;EACnG;AACF;AAEA,SAASkD,gBAAgBA,CAACH,OAAO,EAAEV,MAAM,EAAE;EACzC,SAAAsB,UAAA,GAAAvE,+BAAA,CAAoBiD,MAAM,GAAAuB,MAAA,IAAAA,MAAA,GAAAD,UAAA,IAAAzD,IAAA,GAAE;IAAA,IAAjBuC,KAAK,GAAAmB,MAAA,CAAAzD,KAAA;IACd,IAAIsC,KAAK,CAACe,UAAU,KAAKT,OAAO,EAAE;MAChC,OAAON,KAAK,CAAC5B,IAAI;IACnB;EACF;EACA,MAAM,IAAIc,KAAK,wBAAAC,MAAA,CAAwBmB,OAAO,CAAE,CAAC;AACnD"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = parseSpreadsheetInfo;
7
+ var _xlsx = require("../xml/xlsx.js");
8
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
+ // I guess `xl/workbook.xml` file should always be present inside the *.xlsx archive.
12
+ function parseSpreadsheetInfo(content, xml) {
13
+ var book = xml.createDocument(content);
14
+
15
+ // Read `<workbookPr/>` element to detect whether dates are 1900-based or 1904-based.
16
+ // https://support.microsoft.com/en-gb/help/214330/differences-between-the-1900-and-the-1904-date-system-in-excel
17
+ // http://webapp.docx4java.org/OnlineDemo/ecma376/SpreadsheetML/workbookPr.html
18
+ var workbookProperties = (0, _xlsx.getWorkbookProperties)(book);
19
+ var epoch1904 = Boolean(workbookProperties) && workbookProperties.getAttribute('date1904') === '1';
20
+
21
+ // Example of `<sheets/>` element:
22
+ //
23
+ // <sheets>
24
+ // <sheet
25
+ // xmlns:ns="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
26
+ // name="Sheet1"
27
+ // sheetId="1"
28
+ // ns:id="rId3"/>
29
+ // </sheets>
30
+
31
+ var sheets = [];
32
+ for (var _iterator = _createForOfIteratorHelperLoose((0, _xlsx.getSheets)(book)), _step; !(_step = _iterator()).done;) {
33
+ var sheet = _step.value;
34
+ if (sheet.getAttribute('name')) {
35
+ sheets.push({
36
+ id: sheet.getAttribute('sheetId'),
37
+ name: sheet.getAttribute('name'),
38
+ relationId: sheet.getAttribute('r:id')
39
+ });
40
+ }
41
+ }
42
+ return {
43
+ epoch1904: epoch1904,
44
+ sheets: sheets
45
+ };
46
+ }
47
+ //# sourceMappingURL=parseSpreadsheetInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseSpreadsheetInfo.js","names":["_xlsx","require","_createForOfIteratorHelperLoose","o","allowArrayLike","it","Symbol","iterator","call","next","bind","Array","isArray","_unsupportedIterableToArray","length","i","done","value","TypeError","minLen","_arrayLikeToArray","n","Object","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","parseSpreadsheetInfo","content","xml","book","createDocument","workbookProperties","getWorkbookProperties","epoch1904","Boolean","getAttribute","sheets","_iterator","getSheets","_step","sheet","push","id","relationId"],"sources":["../../source/xlsx/parseSpreadsheetInfo.js"],"sourcesContent":["import {\r\n getWorkbookProperties,\r\n getSheets\r\n} from '../xml/xlsx.js'\r\n\r\n// I guess `xl/workbook.xml` file should always be present inside the *.xlsx archive.\r\nexport default function parseSpreadsheetInfo(content, xml) {\r\n const book = xml.createDocument(content)\r\n\r\n // Read `<workbookPr/>` element to detect whether dates are 1900-based or 1904-based.\r\n // https://support.microsoft.com/en-gb/help/214330/differences-between-the-1900-and-the-1904-date-system-in-excel\r\n // http://webapp.docx4java.org/OnlineDemo/ecma376/SpreadsheetML/workbookPr.html\r\n const workbookProperties = getWorkbookProperties(book)\r\n const epoch1904 = Boolean(workbookProperties) && workbookProperties.getAttribute('date1904') === '1'\r\n\r\n // Example of `<sheets/>` element:\r\n //\r\n // <sheets>\r\n // <sheet\r\n // xmlns:ns=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"\r\n // name=\"Sheet1\"\r\n // sheetId=\"1\"\r\n // ns:id=\"rId3\"/>\r\n // </sheets>\r\n\r\n const sheets = []\r\n for (const sheet of getSheets(book)) {\r\n if (sheet.getAttribute('name')) {\r\n sheets.push({\r\n id: sheet.getAttribute('sheetId'),\r\n name: sheet.getAttribute('name'),\r\n relationId: sheet.getAttribute('r:id')\r\n })\r\n }\r\n }\r\n\r\n return {\r\n epoch1904,\r\n sheets\r\n }\r\n}"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGuB,SAAAC,gCAAAC,CAAA,EAAAC,cAAA,QAAAC,EAAA,UAAAC,MAAA,oBAAAH,CAAA,CAAAG,MAAA,CAAAC,QAAA,KAAAJ,CAAA,oBAAAE,EAAA,UAAAA,EAAA,GAAAA,EAAA,CAAAG,IAAA,CAAAL,CAAA,GAAAM,IAAA,CAAAC,IAAA,CAAAL,EAAA,OAAAM,KAAA,CAAAC,OAAA,CAAAT,CAAA,MAAAE,EAAA,GAAAQ,2BAAA,CAAAV,CAAA,MAAAC,cA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kBAAkB,CAAC,IAAIA,kBAAkB,CAACI,YAAY,CAAC,UAAU,CAAC,KAAK,GAAG;;EAEpG;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA,IAAMC,MAAM,GAAG,EAAE;EACjB,SAAAC,SAAA,GAAA1C,+BAAA,CAAoB,IAAA2C,eAAS,EAACT,IAAI,CAAC,GAAAU,KAAA,IAAAA,KAAA,GAAAF,SAAA,IAAA5B,IAAA,GAAE;IAAA,IAA1B+B,KAAK,GAAAD,KAAA,CAAA7B,KAAA;IACd,IAAI8B,KAAK,CAACL,YAAY,CAAC,MAAM,CAAC,EAAE;MAC9BC,MAAM,CAACK,IAAI,CAAC;QACVC,EAAE,EAAEF,KAAK,CAACL,YAAY,CAAC,SAAS,CAAC;QACjCf,IAAI,EAAEoB,KAAK,CAACL,YAAY,CAAC,MAAM,CAAC;QAChCQ,UAAU,EAAEH,KAAK,CAACL,YAAY,CAAC,MAAM;MACvC,CAAC,CAAC;IACJ;EACF;EAEA,OAAO;IACLF,SAAS,EAATA,SAAS;IACTG,MAAM,EAANA;EACF,CAAC;AACH"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = reconstructSheetDimensionsFromSheetCells;
7
+ function reconstructSheetDimensionsFromSheetCells(cells) {
8
+ var comparator = function comparator(a, b) {
9
+ return a - b;
10
+ };
11
+ var allRows = cells.map(function (cell) {
12
+ return cell.row;
13
+ }).sort(comparator);
14
+ var allCols = cells.map(function (cell) {
15
+ return cell.column;
16
+ }).sort(comparator);
17
+ var minRow = allRows[0];
18
+ var maxRow = allRows[allRows.length - 1];
19
+ var minCol = allCols[0];
20
+ var maxCol = allCols[allCols.length - 1];
21
+ return [{
22
+ row: minRow,
23
+ column: minCol
24
+ }, {
25
+ row: maxRow,
26
+ column: maxCol
27
+ }];
28
+ }
29
+ //# sourceMappingURL=reconstructSheetDimensionsFromSheetCells.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reconstructSheetDimensionsFromSheetCells.js","names":["reconstructSheetDimensionsFromSheetCells","cells","comparator","a","b","allRows","map","cell","row","sort","allCols","column","minRow","maxRow","length","minCol","maxCol"],"sources":["../../source/xlsx/reconstructSheetDimensionsFromSheetCells.js"],"sourcesContent":["export default function reconstructSheetDimensionsFromSheetCells(cells) {\r\n const comparator = (a, b) => a - b\r\n const allRows = cells.map(cell => cell.row).sort(comparator)\r\n const allCols = cells.map(cell => cell.column).sort(comparator)\r\n const minRow = allRows[0]\r\n const maxRow = allRows[allRows.length - 1]\r\n const minCol = allCols[0]\r\n const maxCol = allCols[allCols.length - 1]\r\n return [\r\n { row: minRow, column: minCol },\r\n { row: maxRow, column: maxCol }\r\n ]\r\n}\r\n"],"mappings":";;;;;;AAAe,SAASA,wCAAwCA,CAACC,KAAK,EAAE;EACtE,IAAMC,UAAU,GAAG,SAAbA,UAAUA,CAAIC,CAAC,EAAEC,CAAC;IAAA,OAAKD,CAAC,GAAGC,CAAC;EAAA;EAClC,IAAMC,OAAO,GAAGJ,KAAK,CAACK,GAAG,CAAC,UAAAC,IAAI;IAAA,OAAIA,IAAI,CAACC,GAAG;EAAA,EAAC,CAACC,IAAI,CAACP,UAAU,CAAC;EAC5D,IAAMQ,OAAO,GAAGT,KAAK,CAACK,GAAG,CAAC,UAAAC,IAAI;IAAA,OAAIA,IAAI,CAACI,MAAM;EAAA,EAAC,CAACF,IAAI,CAACP,UAAU,CAAC;EAC/D,IAAMU,MAAM,GAAGP,OAAO,CAAC,CAAC,CAAC;EACzB,IAAMQ,MAAM,GAAGR,OAAO,CAACA,OAAO,CAACS,MAAM,GAAG,CAAC,CAAC;EAC1C,IAAMC,MAAM,GAAGL,OAAO,CAAC,CAAC,CAAC;EACzB,IAAMM,MAAM,GAAGN,OAAO,CAACA,OAAO,CAACI,MAAM,GAAG,CAAC,CAAC;EAC1C,OAAO,CACL;IAAEN,GAAG,EAAEI,MAAM;IAAED,MAAM,EAAEI;EAAO,CAAC,EAC/B;IAAEP,GAAG,EAAEK,MAAM;IAAEF,MAAM,EAAEK;EAAO,CAAC,CAChC;AACH"}
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getBaseStyles = getBaseStyles;
7
+ exports.getCellElements = getCellElements;
7
8
  exports.getCellInlineStringValue = getCellInlineStringValue;
8
9
  exports.getCellStyles = getCellStyles;
9
- exports.getCellValue = getCellValue;
10
- exports.getCells = getCells;
10
+ exports.getCellValueElement = getCellValueElement;
11
11
  exports.getDimensions = getDimensions;
12
- exports.getMergedCells = getMergedCells;
12
+ exports.getMergedCellCoordinates = getMergedCellCoordinates;
13
13
  exports.getNumberFormats = getNumberFormats;
14
14
  exports.getRelationships = getRelationships;
15
15
  exports.getSharedStrings = getSharedStrings;
@@ -18,7 +18,7 @@ exports.getWorkbookProperties = getWorkbookProperties;
18
18
  var _dom = require("./dom.js");
19
19
  // Returns an array of cells,
20
20
  // each element being an XML DOM element representing a cell.
21
- function getCells(document) {
21
+ function getCellElements(document) {
22
22
  var worksheet = document.documentElement;
23
23
  var sheetData = (0, _dom.findChild)(worksheet, 'sheetData');
24
24
  var cells = [];
@@ -29,7 +29,7 @@ function getCells(document) {
29
29
  });
30
30
  return cells;
31
31
  }
32
- function getMergedCells(document) {
32
+ function getMergedCellCoordinates(document) {
33
33
  var worksheet = document.documentElement;
34
34
  var mergedCells = (0, _dom.findChild)(worksheet, 'mergeCells');
35
35
  var mergedCellsInfo = [];
@@ -40,15 +40,15 @@ function getMergedCells(document) {
40
40
  }
41
41
  return mergedCellsInfo;
42
42
  }
43
- function getCellValue(document, node) {
44
- return (0, _dom.findChild)(node, 'v');
43
+ function getCellValueElement(document, element) {
44
+ return (0, _dom.findChild)(element, 'v');
45
45
  }
46
- function getCellInlineStringValue(document, node) {
46
+ function getCellInlineStringValue(document, element) {
47
47
  // It seems as if in some weirdly-output "*.xlsx" files
48
48
  // there're non-element nodes of some weird nature.
49
49
  // https://gitlab.com/catamphetamine/read-excel-file/-/issues/109
50
50
  // This code filters out such weird non-element nodes.
51
- var firstElementChild = (0, _dom.getFirstElementChild)(node);
51
+ var firstElementChild = (0, _dom.getFirstElementChild)(element);
52
52
  if (firstElementChild && (0, _dom.getTagName)(firstElementChild) === 'is') {
53
53
  var firstElementChildFirstElementChild = (0, _dom.getFirstElementChild)(firstElementChild);
54
54
  if (firstElementChildFirstElementChild && (0, _dom.getTagName)(firstElementChildFirstElementChild) === 't') {
@@ -1 +1 @@
1
- {"version":3,"file":"xlsx.js","names":["_dom","require","getCells","document","worksheet","documentElement","sheetData","findChild","cells","forEach","row","cell","push","getMergedCells","mergedCells","mergedCellsInfo","mergedCell","getAttribute","getCellValue","node","getCellInlineStringValue","firstElementChild","getFirstElementChild","getTagName","firstElementChildFirstElementChild","textContent","getDimensions","dimensions","getBaseStyles","styleSheet","cellStyleXfs","findChildren","getCellStyles","cellXfs","getNumberFormats","numberFormats","numFmts","getSharedStrings","sst","map","string","t","value","r","getWorkbookProperties","workbook","getRelationships","relationships","getSheets","sheets"],"sources":["../../source/xml/xlsx.js"],"sourcesContent":["import { findChild, findChildren, forEach, map, getFirstElementChild, getTagName } from './dom.js'\r\n\r\n// Returns an array of cells,\r\n// each element being an XML DOM element representing a cell.\r\nexport function getCells(document) {\r\n const worksheet = document.documentElement\r\n const sheetData = findChild(worksheet, 'sheetData')\r\n\r\n const cells = []\r\n forEach(sheetData, 'row', (row) => {\r\n forEach(row, 'c', (cell) => {\r\n cells.push(cell)\r\n })\r\n })\r\n return cells\r\n}\r\n\r\nexport function getMergedCells(document) {\r\n const worksheet = document.documentElement\r\n const mergedCells = findChild(worksheet, 'mergeCells')\r\n const mergedCellsInfo = []\r\n if (mergedCells) {\r\n forEach(mergedCells, 'mergeCell', (mergedCell) => {\r\n mergedCellsInfo.push(mergedCell.getAttribute('ref'))\r\n })\r\n }\r\n return mergedCellsInfo\r\n}\r\n\r\nexport function getCellValue(document, node) {\r\n return findChild(node, 'v')\r\n}\r\n\r\nexport function getCellInlineStringValue(document, node) {\r\n // It seems as if in some weirdly-output \"*.xlsx\" files\r\n // there're non-element nodes of some weird nature.\r\n // https://gitlab.com/catamphetamine/read-excel-file/-/issues/109\r\n // This code filters out such weird non-element nodes.\r\n const firstElementChild = getFirstElementChild(node)\r\n if (firstElementChild && getTagName(firstElementChild) === 'is') {\r\n const firstElementChildFirstElementChild = getFirstElementChild(firstElementChild)\r\n if (firstElementChildFirstElementChild && getTagName(firstElementChildFirstElementChild) === 't') {\r\n return firstElementChildFirstElementChild.textContent\r\n }\r\n }\r\n}\r\n\r\nexport function getDimensions(document) {\r\n const worksheet = document.documentElement\r\n const dimensions = findChild(worksheet, 'dimension')\r\n if (dimensions) {\r\n return dimensions.getAttribute('ref')\r\n }\r\n}\r\n\r\nexport function getBaseStyles(document) {\r\n const styleSheet = document.documentElement\r\n const cellStyleXfs = findChild(styleSheet, 'cellStyleXfs')\r\n if (cellStyleXfs) {\r\n return findChildren(cellStyleXfs, 'xf')\r\n }\r\n return []\r\n}\r\n\r\nexport function getCellStyles(document) {\r\n const styleSheet = document.documentElement\r\n const cellXfs = findChild(styleSheet, 'cellXfs')\r\n if (!cellXfs) {\r\n return []\r\n }\r\n return findChildren(cellXfs, 'xf')\r\n}\r\n\r\nexport function getNumberFormats(document) {\r\n const styleSheet = document.documentElement\r\n let numberFormats = []\r\n const numFmts = findChild(styleSheet, 'numFmts')\r\n if (numFmts) {\r\n return findChildren(numFmts, 'numFmt')\r\n }\r\n return []\r\n}\r\n\r\nexport function getSharedStrings(document) {\r\n\t// An `<si/>` element can contain a `<t/>` (simplest case) or a set of `<r/>` (\"rich formatting\") elements having `<t/>`.\r\n\t// https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sharedstringitem?redirectedfrom=MSDN&view=openxml-2.8.1\r\n\t// http://www.datypic.com/sc/ooxml/e-ssml_si-1.html\r\n\r\n const sst = document.documentElement\r\n return map(sst, 'si', string => {\r\n const t = findChild(string, 't')\r\n if (t) {\r\n return t.textContent\r\n }\r\n let value = ''\r\n forEach(string, 'r', (r) => {\r\n value += findChild(r, 't').textContent\r\n })\r\n return value\r\n })\r\n}\r\n\r\nexport function getWorkbookProperties(document) {\r\n const workbook = document.documentElement\r\n return findChild(workbook, 'workbookPr')\r\n}\r\n\r\nexport function getRelationships(document) {\r\n const relationships = document.documentElement\r\n return findChildren(relationships, 'Relationship')\r\n}\r\n\r\nexport function getSheets(document) {\r\n const workbook = document.documentElement\r\n const sheets = findChild(workbook, 'sheets')\r\n return findChildren(sheets, 'sheet')\r\n}"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AAEA;AACA;AACO,SAASC,QAAQA,CAACC,QAAQ,EAAE;EACjC,IAAMC,SAAS,GAAGD,QAAQ,CAACE,eAAe;EAC1C,IAAMC,SAAS,GAAG,IAAAC,cAAS,EAACH,SAAS,EAAE,WAAW,CAAC;EAEnD,IAAMI,KAAK,GAAG,EAAE;EAChB,IAAAC,YAAO,EAACH,SAAS,EAAE,KAAK,EAAE,UAACI,GAAG,EAAK;IACjC,IAAAD,YAAO,EAACC,GAAG,EAAE,GAAG,EAAE,UAACC,IAAI,EAAK;MAC1BH,KAAK,CAACI,IAAI,CAACD,IAAI,CAAC;IAClB,CAAC,CAAC;EACJ,CAAC,CAAC;EACF,OAAOH,KAAK;AACd;AAEO,SAASK,cAAcA,CAACV,QAAQ,EAAE;EACvC,IAAMC,SAAS,GAAGD,QAAQ,CAACE,eAAe;EAC1C,IAAMS,WAAW,GAAG,IAAAP,cAAS,EAACH,SAAS,EAAE,YAAY,CAAC;EACtD,IAAMW,eAAe,GAAG,EAAE;EAC1B,IAAID,WAAW,EAAE;IACf,IAAAL,YAAO,EAACK,WAAW,EAAE,WAAW,EAAE,UAACE,UAAU,EAAK;MAChDD,eAAe,CAACH,IAAI,CAACI,UAAU,CAACC,YAAY,CAAC,KAAK,CAAC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5C,QAAQ,CAACE,eAAe;EAC9C,OAAO,IAAA0B,iBAAY,EAACgB,aAAa,EAAE,cAAc,CAAC;AACpD;AAEO,SAASC,SAASA,CAAC7C,QAAQ,EAAE;EAClC,IAAM0C,QAAQ,GAAG1C,QAAQ,CAACE,eAAe;EACzC,IAAM4C,MAAM,GAAG,IAAA1C,cAAS,EAACsC,QAAQ,EAAE,QAAQ,CAAC;EAC5C,OAAO,IAAAd,iBAAY,EAACkB,MAAM,EAAE,OAAO,CAAC;AACtC"}
1
+ {"version":3,"file":"xlsx.js","names":["_dom","require","getCellElements","document","worksheet","documentElement","sheetData","findChild","cells","forEach","row","cell","push","getMergedCellCoordinates","mergedCells","mergedCellsInfo","mergedCell","getAttribute","getCellValueElement","element","getCellInlineStringValue","firstElementChild","getFirstElementChild","getTagName","firstElementChildFirstElementChild","textContent","getDimensions","dimensions","getBaseStyles","styleSheet","cellStyleXfs","findChildren","getCellStyles","cellXfs","getNumberFormats","numberFormats","numFmts","getSharedStrings","sst","map","string","t","value","r","getWorkbookProperties","workbook","getRelationships","relationships","getSheets","sheets"],"sources":["../../source/xml/xlsx.js"],"sourcesContent":["import { findChild, findChildren, forEach, map, getFirstElementChild, getTagName } from './dom.js'\r\n\r\n// Returns an array of cells,\r\n// each element being an XML DOM element representing a cell.\r\nexport function getCellElements(document) {\r\n const worksheet = document.documentElement\r\n const sheetData = findChild(worksheet, 'sheetData')\r\n\r\n const cells = []\r\n forEach(sheetData, 'row', (row) => {\r\n forEach(row, 'c', (cell) => {\r\n cells.push(cell)\r\n })\r\n })\r\n return cells\r\n}\r\n\r\nexport function getMergedCellCoordinates(document) {\r\n const worksheet = document.documentElement\r\n const mergedCells = findChild(worksheet, 'mergeCells')\r\n const mergedCellsInfo = []\r\n if (mergedCells) {\r\n forEach(mergedCells, 'mergeCell', (mergedCell) => {\r\n mergedCellsInfo.push(mergedCell.getAttribute('ref'))\r\n })\r\n }\r\n return mergedCellsInfo\r\n}\r\n\r\nexport function getCellValueElement(document, element) {\r\n return findChild(element, 'v')\r\n}\r\n\r\nexport function getCellInlineStringValue(document, element) {\r\n // It seems as if in some weirdly-output \"*.xlsx\" files\r\n // there're non-element nodes of some weird nature.\r\n // https://gitlab.com/catamphetamine/read-excel-file/-/issues/109\r\n // This code filters out such weird non-element nodes.\r\n const firstElementChild = getFirstElementChild(element)\r\n if (firstElementChild && getTagName(firstElementChild) === 'is') {\r\n const firstElementChildFirstElementChild = getFirstElementChild(firstElementChild)\r\n if (firstElementChildFirstElementChild && getTagName(firstElementChildFirstElementChild) === 't') {\r\n return firstElementChildFirstElementChild.textContent\r\n }\r\n }\r\n}\r\n\r\nexport function getDimensions(document) {\r\n const worksheet = document.documentElement\r\n const dimensions = findChild(worksheet, 'dimension')\r\n if (dimensions) {\r\n return dimensions.getAttribute('ref')\r\n }\r\n}\r\n\r\nexport function getBaseStyles(document) {\r\n const styleSheet = document.documentElement\r\n const cellStyleXfs = findChild(styleSheet, 'cellStyleXfs')\r\n if (cellStyleXfs) {\r\n return findChildren(cellStyleXfs, 'xf')\r\n }\r\n return []\r\n}\r\n\r\nexport function getCellStyles(document) {\r\n const styleSheet = document.documentElement\r\n const cellXfs = findChild(styleSheet, 'cellXfs')\r\n if (!cellXfs) {\r\n return []\r\n }\r\n return findChildren(cellXfs, 'xf')\r\n}\r\n\r\nexport function getNumberFormats(document) {\r\n const styleSheet = document.documentElement\r\n let numberFormats = []\r\n const numFmts = findChild(styleSheet, 'numFmts')\r\n if (numFmts) {\r\n return findChildren(numFmts, 'numFmt')\r\n }\r\n return []\r\n}\r\n\r\nexport function getSharedStrings(document) {\r\n\t// An `<si/>` element can contain a `<t/>` (simplest case) or a set of `<r/>` (\"rich formatting\") elements having `<t/>`.\r\n\t// https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sharedstringitem?redirectedfrom=MSDN&view=openxml-2.8.1\r\n\t// http://www.datypic.com/sc/ooxml/e-ssml_si-1.html\r\n\r\n const sst = document.documentElement\r\n return map(sst, 'si', string => {\r\n const t = findChild(string, 't')\r\n if (t) {\r\n return t.textContent\r\n }\r\n let value = ''\r\n forEach(string, 'r', (r) => {\r\n value += findChild(r, 't').textContent\r\n })\r\n return value\r\n })\r\n}\r\n\r\nexport function getWorkbookProperties(document) {\r\n const workbook = document.documentElement\r\n return findChild(workbook, 'workbookPr')\r\n}\r\n\r\nexport function getRelationships(document) {\r\n const relationships = document.documentElement\r\n return findChildren(relationships, 'Relationship')\r\n}\r\n\r\nexport function getSheets(document) {\r\n const workbook = document.documentElement\r\n const sheets = findChild(workbook, 'sheets')\r\n return findChildren(sheets, 'sheet')\r\n}"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AAEA;AACA;AACO,SAASC,eAAeA,CAACC,QAAQ,EAAE;EACxC,IAAMC,SAAS,GAAGD,QAAQ,CAACE,eAAe;EAC1C,IAAMC,SAAS,GAAG,IAAAC,cAAS,EAACH,SAAS,EAAE,WAAW,CAAC;EAEnD,IAAMI,KAAK,GAAG,EAAE;EAChB,IAAAC,YAAO,EAACH,SAAS,EAAE,KAAK,EAAE,UAACI,GAAG,EAAK;IACjC,IAAAD,YAAO,EAACC,GAAG,EAAE,GAAG,EAAE,UAACC,IAAI,EAAK;MAC1BH,KAAK,CAACI,IAAI,CAACD,IAAI,CAAC;IAClB,CAAC,CAAC;EACJ,CAAC,CAAC;EACF,OAAOH,KAAK;AACd;AAEO,SAASK,wBAAwBA,CAACV,QAAQ,EAAE;EACjD,IAAMC,SAAS,GAAGD,QAAQ,CAACE,eAAe;EAC1C,IAAMS,WAAW,GAAG,IAAAP,cAAS,EAACH,SAAS,EAAE,YAAY,CAAC;EACtD,IAAMW,eAAe,GAAG,EAAE;EAC1B,IAAID,WAAW,EAAE;IACf,IAAAL,YAAO,EAACK,WAAW,EAAE,WAAW,EAAE,UAACE,UAAU,EAAK;MAChDD,eAAe,CAACH,IAAI,CAACI,UAAU,CAACC,YAAY,CAAC,KAAK,C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