Programming

git diff를 사용하여 두 개의 스프레드 시트로 읽을 수있는 diff를 만들려면 어떻게합니까?

procodes 2020. 5. 29. 23:22
반응형

git diff를 사용하여 두 개의 스프레드 시트로 읽을 수있는 diff를 만들려면 어떻게합니까?


소스 코드 저장소에는 많은 스프레드 시트 (xls)가 있습니다. 이들은 일반적으로 gnumeric 또는 openoffice.org로 편집되며 dbUnit으로 단위 테스트를 위해 데이터베이스를 채우는 데 주로 사용됩니다 . 내가 아는 xls 파일에서 diff를 수행하는 쉬운 방법이 없으므로 병합이 매우 지루하고 오류가 발생하기 쉽습니다.

스프레드 시트를 xml로 변환하고 정기적으로 비교를 시도했지만 실제로 마지막 수단이되어야한다고 생각합니다.

git텍스트 파일 마찬가지로 diffing (및 병합)을 수행하고 싶습니다 . 예를 들어, 발행 할 때 어떻게해야 git diff합니까?


우리는 공동으로 똑같은 문제에 직면했습니다. 테스트 결과 Excel 통합 문서가 출력되었습니다. 이진 diff는 옵션이 아니 었습니다. 그래서 우리는 우리 자신의 간단한 명령 행 도구를 출시했습니다. ExcelCompare 프로젝트를 확인하십시오 . 실제로 이것은 테스트를 아주 훌륭하게 자동화 할 수있게합니다. 패치 / 기능 요청은 매우 환영합니다!


외부 도구를 사용하지 않고 빠르고 쉽게 비교할 수있는 두 시트가 비슷한 한 잘 작동합니다.

  • 세 번째 스프레드 시트 작성
  • =if(Sheet1!A1 <> Sheet2!A1, "X", "")왼쪽 상단 셀에 입력 하십시오 (또는 동등한 것 : 실제 셀을 클릭하면 참조가 자동으로 수식에 삽입됩니다)
  • Ctrl+C(복사), Ctrl+A(모두 선택), Ctrl+V(붙여 넣기)를 사용하여 시트를 채 웁니다.

시트가 유사한 경우이 스프레드 시트는 X가 포함 된 몇 개의 셀을 제외하고 비어 있으며 차이점을 강조 표시합니다. 40 %로 확대를 해제하면 다른 점을 빠르게 확인할 수 있습니다.


과거에 Excel 통합 문서를 많이 비교했습니다. 내 기술은 워크 시트가 많은 통합 문서에 매우 효과적이지만 셀 서식, 매크로 등이 아닌 셀 내용 만 비교합니다. 또한 코딩이 관련되어 있지만 많은 큰 파일을 반복적으로 비교 해야하는 경우 가치가 있습니다. 작동 방식은 다음과 같습니다.

A) 모든 워크 시트를 단계별로 실행하고 모든 데이터를 탭으로 구분 된 파일로 저장하는 간단한 덤프 프로그램을 작성하십시오. 워크 시트 당 하나의 파일을 작성하고 (워크 시트 이름을 파일 이름으로 사용하십시오 (예 : "MyWorksheet.tsv") 프로그램을 실행할 때마다 해당 파일에 대한 새 폴더를 작성하십시오. Excel 파일 이름 뒤에 폴더 이름을 지정하고 타임 스탬프를 추가하십시오 (예 : "20080922-065412-MyExcelFile"). JExcelAPI 라는 라이브러리를 사용하여 Java 에서이 작업을 수행했습니다 . 정말 쉽습니다.

B) Excel 파일을 마우스 오른쪽 단추로 클릭 할 때 A 단계에서 새 Java 프로그램을 실행하도록 Windows 쉘 확장을 추가하십시오. 이를 통해이 프로그램을 매우 쉽게 실행할 수 있습니다. 이 작업을 수행하는 방법은 Google에 필요하지만 * .reg 파일을 작성하는 것만 큼 쉽습니다.

C) BeyondCompare를 얻으 십시오 . 멋진 테이블에 표시하여 구분 된 데이터를 비교할 수있는 매우 멋진 기능이 있습니다 (스크린 샷 참조) .

D) 이제 Excel 파일을 쉽게 비교할 준비가되었습니다. Excel 파일 1을 마우스 오른쪽 단추로 클릭하고 덤프 프로그램을 실행하십시오. 워크 시트 당 하나의 파일로 폴더를 만듭니다. Excel 파일 2를 마우스 오른쪽 단추로 클릭하고 덤프 프로그램을 실행하십시오. 워크 시트 당 하나의 파일로 두 번째 폴더를 만듭니다. 이제 BC (BeyondCompare)를 사용하여 폴더를 비교하십시오. 각 파일은 워크 시트를 나타내므로 워크 시트에 차이가 있으면 BC에이를 표시하고 드릴 다운하여 파일을 비교할 수 있습니다. BC는 멋진 테이블 레이아웃으로 비교를 표시하며 관심이없는 행과 열을 숨길 수 있습니다.


이 무료 온라인 도구를 사용해보십시오 -www.cloudyexcel.com/compare-excel/

행 추가, 삭제, 변경 등의 관점에서 온라인으로 좋은 시각적 출력을 제공합니다.

여기에 이미지 설명을 입력하십시오

또한 아무것도 설치할 필요가 없습니다.


xdocdiff WinMerge Plugin 을 찾았습니다 . WinMerge 용 플러그인입니다 ( OpenSourceFreeware 모두 VBA를 작성하거나 Excel을 csv 또는 xml에 저장할 필요가 없습니다). 그것은 단지 상자에 들어 있습니다.

이 플러그인은 다음도 지원합니다.

  • .rtf 리치 텍스트
  • .docx / .docm Microsoft WORD 2007 (OOXML)
  • .xlsx / .xlsm Microsoft Excel 2007 (OOXML)
  • .pptx / .pptm Microsoft PowerPoint 2007 (OOXML)
  • .doc Microsoft WORD ver5.0 / 95 / 97 / 2000 / XP / 2003
  • .xls Microsoft Excel ver5.0 / 95 / 97 / 2000 / XP / 2003
  • .ppt Microsoft PowerPoint 97 / 2000 / XP / 2003
  • .sxw / .sxc / .sxi / .sxd OpenOffice.org
  • .odt / .ods / .odp / .odg 문서 열기
  • .wj2 / wj3 / wk3 / wk4 / 123 로터스 123
  • .wri Windows3.1 쓰기
  • .pdf Adobe PDF
  • .mht 웹 아카이브
  • .eml OutlookExpress에서 내 보낸 파일

안드레스


흠. Excel 메뉴에서 창-> 나란히 비교 하시겠습니까?


Subversion에서 커밋 및 업데이트를 수행하기 위해 TortoiseSVN을 사용합니까? diff 도구가 있지만 Excel 파일을 비교하는 것은 여전히 ​​사용자 친화적이지 않습니다. 내 환경 (Win XP, Office 2007)에서 나란히 비교하기 위해 두 개의 Excel 파일이 열립니다.

문서> Tortoise SVN> 로그 표시> 개정 선택> "작업 사본과 비교"를 마우스 오른쪽 단추로 클릭하십시오.


I know several responses have suggested exporting the file to csv or some other text format, and then comparing them. I haven't seen it mentioned specifically, but Beyond Compare 3 has a number of additional file formats that it supports. See Additional File Formats. Using one of the Microsoft Excel File Formats you can easily compare two Excel files without going through the export to another format option.


Newer versions of MS Office come with Spreadsheet Compare, which performs a fairly nice diff in a GUI. It detects most kinds of changes.


There is a library daff (short for data diff) which helps in comparing tables, producing a summary of their diffs, and using such a summary as a patch file.

It is written in Haxe, so it can be compiled in major languages.

I have made an Excel Diff Tool in Javascript with help of this library. It works well with numbers & small strings but the output is not ideal for long strings (e.g. a long sentence with with minor character change).


I would use the SYLK file format if performing diffs is important. It is a text-based format, which should make the comparisons easier and more compact than a binary format. It is compatible with Excel, Gnumeric, and OpenOffice.org as well, so all three tools should be able to work well together. SYLK Wikipedia Article


Use Altova DiffDog

Use diffdog's XML diff mode and Grid View to review the differences in an easy to read tabular format. Text diff'ing is MUCH HARDER for spreadsheets of any complexity. With this tool, at least two methods are viable under various circumstances.

  1. Save As .xml

    To detect the differences of a simple, one sheet spreadsheet, save the Excel spreadsheets to compare as XML Spreadsheet 2003 with a .xml extension.

  2. Save As .xlsx

    To detect the differences of most spreadsheets in a modularized document model, save the Excel spreadsheets to compare as an Excel Workbook in .xlsx form. Open the files to diff with diffdog. It informs you that the file is a ZIP archive, and asks if you want to open it for directory comparison. Upon agreeing to directory comparison, it becomes a relatively simple matter of double-clicking logical parts of the document to diff them (with the XML diff mode). Most parts of the .xslx document are XML-formatted data. The Grid View is extremely useful. It is trivial to diff individual sheets to focus the analysis on areas that are known to have changed.

Excel's propensity to tweak certain attribute names with every save is annoying, but diffdog's XML diff'ing capabilities include the ability to filter certain kinds of differences. For example, Excel spreadsheets in XML form contain row and c elements that have s attributes (style) that rename with every save. Setting up a filter like c:s makes it much easier to view only content changes.

diffdog has a lot of diff'ing capability. I've listed the XML diff modes only simply because I haven't used another tool that I liked better when it comes to differencing Excel documents.


I found an openoffice macro here that will invoke openoffice's compare documents function on two files. Unfortunately, openoffice's spreadsheet compare seems a little flaky; I just had the 'Reject All' button insert a superfluous column in my document.


xdocdiff plugin for SVN


If you're using Java, you could try simple-excel.

It'll diff spreadsheets using Hamcrest matchers and output something like this.

java.lang.AssertionError:
Expected: entire workbook to be equal
     but: cell at "C14" contained <"bananas"> expected <nothing>,
          cell at "C15" contained <"1,850,000 EUR"> expected <"1,850,000.00 EUR">,
          cell at "D16" contained <nothing> expected <"Tue Sep 04 06:30:00">
    at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)

I should qualify that we wrote that tool (like the ticked answer rolled their own).


If you have TortoiseSVN then you can CTRL click the two files to select them in Windows Explorer and then right-click, TortoiseSVN->Diff.

This works particularly well if you are looking for a small change in a large data set.


I got the problem like you so I decide to write small tool to help me out. Please check ExcelDiff_Tools. It comes with several key points:

  • Support xls, xlsx, xlsm.
  • With formula cell. It will compare both formula and value.
  • I try to make UI look like standard diff text viewer with : modified, deleted, added, unchanged status. Please take a look with image below for example: 여기에 이미지 설명을 입력하십시오

Diff Doc may be what you're looking for.

  • Compare documents of MS Word (DOC, DOCX etc), Excel, PDF, Rich Text (RTF), Text, HTML, XML, PowerPoint, or Wordperfect and retain formatting
  • Choose any portion of any document (file) and compare it against any portion of the same or different document (file).

I don't know of any tools, but there are two roll-your-own solutions that come to mind, both require Excel:

  1. You could write some VBA code that steps through each Worksheet, Row, Column and Cell of the two Workbooks, reporting differences.

  2. If you use Excel 2007, you could save the Workbooks as Open-XML (*.xlsx) format, extract the XML and diff that. The Open-XML file is essentially just a .zip file of .xml files and manifests.

You'll end up with a lot of "noise" in either case if your spreadsheets aren't structurally "close" to begin with.


Convert to cvs then upload to a version control system then diff with an advanced version control diff tool. When I used perforce it had a great diff tool, but I forget the name of it.


I'm the co-author of a free, open-source Git extension:

https://github.com/ZoomerAnalytics/git-xltrail

It makes Git work with any Excel workbook file format without any workarounds.

참고 : https://stackoverflow.com/questions/114698/how-do-i-create-a-readable-diff-of-two-spreadsheets-using-git-diff

반응형