Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/jmarxuach/json2xlsm
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarxuach committed Aug 2, 2020
2 parents f507399 + 5c85b2e commit daa3097
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path

name: Maven Package

on:
release:
types: [created]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Build with Maven
run: mvn -B package --file lib/pom.xml

- name: Publish to GitHub Packages Apache Maven
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml --file lib/pom.xml
env:
GITHUB_TOKEN: ${{ github.token }}
24 changes: 24 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Maven
run: mvn -B package --file pom.xml
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,32 @@

# json2xlsm
Adds json data file into xlsm first sheet macro excel file
Adds json data file into xlsm first sheet macro excel file.
Usefull from PHP or any language that doesn't have Excel Macro library.

## Usage

If you want to use a xlsm excel sheet from PHP or any other language, json2xlsm will fill first sheet data with JSON file. Usually you create a xlsm with your macros in Vb and you do not need to edit macros from PHP or any other language, but you need to replace sheet data in XLSM files.

```
java -jar json2xlsm.jar <strFileJSON> <strMacroExcelFileIn> <strMacroExcelFileOut>
```

## Creating JSON file from PHP and executing json2xlsm

All values must be in UTF8.

```php

$array = array(
0 => array("field1" => "Value", "field2" => "Value"),
1 => array("field1" => "Value", "field2" => "Value"),
2 => array("field1" => "Value", "field2" => "Value"),
);

$jsonString = json_encode($array);

file_put_contents("jsonFilename.json", $jsonString);

shell_exec("java -jar json2xlsm.jar jsonFilename.json MacroExcelTemplateFile.xlsm MacroExcelFileOut.xlsm");

```

0 comments on commit daa3097

Please sign in to comment.