-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathAPICall.ts
More file actions
26 lines (22 loc) · 709 Bytes
/
APICall.ts
File metadata and controls
26 lines (22 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
async function main(workbook: ExcelScript.Workbook) {
// Replace the {USERNAME} with your Gitub username
const response = await fetch('https://api.github.com/users/{USERNAME}/repos');
const repos: Repository[] = await response.json();
const rows: (string | boolean | number)[][] = [];
for (let repo of repos){
rows.push([repo.id, repo.name, repo.license?.name, repo.license?.url])
}
const sheet = workbook.getActiveWorksheet();
const range = sheet.getRange('A2').getResizedRange(rows.length - 1, rows[0].length - 1);
range.setValues(rows);
return;
}
interface Repository {
name: string,
id: string,
license?: License
}
interface License {
name: string,
url: string
}