Skip to content

Commit

Permalink
add exceljs (#1759)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xverin authored Jun 8, 2023
1 parent 1f842a2 commit 97f80f7
Show file tree
Hide file tree
Showing 3 changed files with 575 additions and 54 deletions.
4 changes: 2 additions & 2 deletions scripts/ts-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"dependencies": {
"@polkadot/api": "^10.3.1",
"colors": "^1.4.0",
"exceljs": "^4.3.0",
"prettier": "^2.8.7",
"ts-node": "^10.9.1",
"typescript": "^5.0.4",
"xlsx": "^0.18.5"
"typescript": "^5.0.4"
},
"devDependencies": {
"@types/node": "^18.15.11"
Expand Down
15 changes: 7 additions & 8 deletions scripts/ts-utils/transfer-to-whitelist.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

//run:npx ts-node transfer-to-whitelist.ts
import * as XLSX from 'xlsx';
import { initApi } from "./initApis";
import colors from 'colors';
let whiteList: any;

import * as ExcelJS from 'exceljs';
//100 token
const transferAmount = '100000000000000';

Expand Down Expand Up @@ -33,14 +32,14 @@ async function main() {
//download whitelist from google sheet (https://docs.google.com/spreadsheets/d/1QD0gVraqDDOkdJk-vhLMZEbdnbAOt_ogiJ3uHau_1Kw/edit#gid=950765040)
//put the whitelist in the same folder as this script
//read whitelist from excel
const workbook = XLSX.readFile('Whitelist R1 & R2.xlsx');
const workbook = new ExcelJS.Workbook();
await workbook.xlsx.readFile('Whitelist R1 & R2.xlsx');

//read sheet 'Whitelisted Addresses for R1'
const sheet = workbook.Sheets['Whitelisted Addresses for R1'];
// Read sheet 'Whitelisted Addresses for R1'
const worksheet = workbook.getWorksheet('Whitelisted Addresses for R1');

//read the second column of the sheet and skip the first row
whiteList = XLSX.utils.sheet_to_json(sheet, { header: 1 })
.map((row: any) => row[1]).slice(1);
// Read the second column of the sheet and skip the first row
whiteList = worksheet.getColumn(2).values.slice(1);

const { defaultAPI } = await initApi();

Expand Down
Loading

0 comments on commit 97f80f7

Please sign in to comment.