본문 바로가기

Script/Perl

22. Excel

 
설치전 셋팅
 
1. http://cygwin.com 에 들어가서 아래 것 다운로드 및 설치
       Current Cygwin DLL version download: setup-x86_64.exe (64-bit installation)

 

2. 실행파일을 더블 클릭하여 설치 형태는 Install from Internet선택,
  설치 폴더는 C:\cygwin64로 자동 지정, 모든 사용자를 위한 설치 선택,
  지역 펙키지 폴더 선택: 내 문서로 선택.
  인터넷 연결 선택: 직접적인 연결(Direct connection)
  다운로드 사이트 선택: http://ftp.daum.net
  패키지 선택: 초기값은 Default로 되어 있으나 필요한 것들을 Install로 전환함. 
                  아래는 내가 Install 로 전환한 것들.
     - make: The GNU version of the ‘make’ utility 
     - Perl Interpreters
     - mintty
 
3.  설치후 환경변수에 C:\cygwin64bin 디렉터리 등록
 
 
 
설치방법
 
아래 사이트에 들어가서 Module 을 다운로드
 
받은 파일 unzip 하고

 

    tar -zxvf Spreadsheet-WriteExcel-0.xx.tar.gz
 
cygwin 들어가서 위 unzip 한 폴더 이동후 아래 명령 수행

 

perl Makefile.PL
make
make test
make install # You may need to be root
make clean # optional
 
 
Sample
 
       #C:\cygwin64\lib\perl5\site_perl\5.22\Spreadsheet
 
       use Spreadsheet::WriteExcel;
 
       # Create a new Excel workbook
       my $workbook = Spreadsheet::WriteExcel->new ('perl.xls');
 
       # Add a worksheet
      $ worksheet = $workbook -> add_worksheet();
 
       #  Add and define a format
      $ format = $workbook -> add_format();    # Add a format
      $ format->set_bold ();
       $format -> set_color( 'red');
       $format -> set_align( 'center');
 
       # Write a formatted and unformatted string, row and column notation.
      $ col = $row = 0;
       $worksheet ->write( $row , $ col, 'Hi Excel!' , $ format );
       $worksheet ->write( 1, $col, 'Hi Excel!' );
 
       # Write a number and a formula using A1 notation
      $ worksheet->write ( 'A3', 1.2345 );
       $worksheet ->write( 'A4', '=SIN(PI()/4)' );
 
 
 
Document
 
 
 
 
Example
 
 
 
 
 
 

'Script > Perl' 카테고리의 다른 글

24. Perl Debugging  (0) 2020.01.21
23. Error Handling  (0) 2020.01.21
21. Directory  (0) 2020.01.21
20. System  (0) 2020.01.21
19. File  (0) 2020.01.21